Targeting candles and pips

 
Hello programmers,
How do I achieve the following:
  • If current candle is above SMA by 10 pips then BUY
  • If current candle is below SMA by 10 pips then SELL
This is what I currently have and it's not working :( , help would be greatly appreciated. Thanks!

//+------------------------------+

//|  OPEN BUY ORDER              |

//+------------------------------+

   if (High[0] > sma && Point >= Open_Pips) {

      ticket = OrderSend(Symbol(), OP_BUY, Lots, ND(Ask), 0, 0, 0, "(FTM) BUY Order Opened", Magic_Instance); 

   }

      

//+------------------------------+

//|  OPEN SELL ORDER             |

//+------------------------------+

   else if(Low[0] < sma && Point >= Open_Pips) {

      ticket = OrderSend(Symbol(), OP_SELL, Lots, ND(Bid), 0, 0, 0, "(FTM) SELL Order Opened", Magic_Instance); 

   } 


 
Point >= Open_Pips)

What is this supposed to do?

Point is the smallest price increment possible, what is Open_Pips?

 if(High[0]-SMA>=pips_required_above_SMA)

 check the difference between price and SMA

 

I thought Point was the amount the current candle has moved in pips, ok I was wrong here.

Open_Pips serves the same purpose as pips_required_above_SMA.

 

Currently the EA no longer trades. Would I be correct in saying that if current candle is above SMA by 80 pips then BUY, as seen in the image and example below?

if(High[0] - SMA >= 80) 

 

 Example 2

 
sysvar:

I thought Point was the amount the current candle has moved in pips, ok I was wrong here.

Open_Pips serves the same purpose as pips_required_above_SMA.

 

Currently the EA no longer trades. Would I be correct in saying that if current candle is above SMA by 80 pips then BUY, as seen in the image and example below?

if(High[0] - SMA >= 80) 

 The price at the crosshairs is 119.391

so the high would need to be at least

119.391+80, so 199.391

That is not correct.

If you want to check for 80 Points above then

if(High[0] - SMA >= 80*Point) 

If you are using pips, you will need to convert pips to points 

 

 

GumRai your a genius! , this has fixed my issue, really appreciate your help :)

Just need to work on an exit strategy, thinking of closing when going 30 pips below sma.

Working 

 
sysvar:

GumRai your a genius! , this has fixed my issue, really appreciate your help :)

Just need to work on an exit strategy, thinking of closing when going 30 pips below sma.

 

No, not a genius. Your mistake is a common one when first learning.

Sorry, I have no idea why my previous answer ended up inside your quote box. I am sure that it was outside when I wrote it. It was also unusual for the quote to include the SRC as normally, it doesn't 

 

Well thanks anyway.

I thought I was smart enough to fix the opposite of the BUY, but no :( , just won't execute SELL orders when current candle is below SMA by 80 pips then trade SELL.

In short clearly I have mis-understood the logic inside the IF statements, if you can recommend any online resources that would be helpful and of course if you can tell me what I'm doing wrong as well that would be great. 

Working:

if(High[0] - SMA >= 80.0 * Point) { BUY.... }

 

No Orders Executed :( 

else if(Low[0] - SMA >= 80.0 * Point) { SELL... } 

 
sysvar:

Well thanks anyway.

I thought I was smart enough to fix the opposite of the BUY, but no :( , just won't execute SELL orders when current candle is below SMA by 80 pips then trade SELL.

In short clearly I have mis-understood the logic inside the IF statements, if you can recommend any online resources that would be helpful and of course if you can tell me what I'm doing wrong as well that would be great. 

Working:

if(High[0] - SMA >= 80.0 * Point) { BUY.... }

 

No Orders Executed :( 

else if(Low[0] - SMA >= 80.0 * Point) { SELL... } 


Come on, you are looking for prices below SMA!

else if( SMA-Low[0] >= 80.0 * Point) { SELL... } 
 
sysvar: I thought Point was the amount the current candle has moved in pips, ok I was wrong here.

There is Tick, PIP, and Point. They are all different in general. A tick is the smallest change of price. A Point is the least significant digit quoted. In currencies a pip is defined as 0.0001 (or for JPY 0.01)

On a 4 digit broker a point (0.0001) = pip (0.0001). [JPY 0.01 == 0.01] On a 5 digit broker a point (0.00001) = 1/10 pip (0.00010/10). Just because you quote an extra digit doesn't change the value of a pip. (0.0001 == 0.00010) EA's must adjust pips to points (for mq4.) In currencies a tick is a point. Price can change by least significant digit (1.23456 -> 1.23457)

In metals a Tick is still the smallest change but is larger than a point. If price can change from 123.25 to 123.50, you have a TickSize of 0.25 and a point of 0.01. Pip has no meaning.

This is why you don't use TickValue by itself. Only as a ratio with TickSize. See DeltaValuePerLot()

 
Many thanks GumRai for sticking with me, and WHRoeder for the detailed explanation, I will read up on these.
Reason: