mql4 programming help needed

To add comments, please log in or register
sadeth06
73
sadeth06  

How to write this code in mql4?

if (Open price > SMA5) AND  (Current price  crossing SMA5) BUY

if (Open price < SMA5) AND  (Current price  crossing SMA5) SELL

I tried auto generator but came with this rule. please help me.

 if((Close[0]<iMA(NULL,0,5,0,MODE_SMA,PRICE_CLOSE,0))&&(currentPrice=iMA(NULL,0,5,0,MODE_SMA,PRICE_CLOSE,0))) // Here is your open buy rule

   

 

Alain Verleyen
36065
Alain Verleyen  
Don't double post please.
Marco vd Heijden
Moderator
8170
Marco vd Heijden  
You can have a look at and try to modify the macd sample : https://www.mql5.com/en/search#!keyword=macd%20sample&module=mql5_module_codebase
Search - MQL5.community
Search - MQL5.community
  • www.mql5.com
Searching is based on morphology and is insensitive to case. All letters, no matter of their case, will be processed as lowercase. By default, our search engine shows pages, that...
sadeth06
73
sadeth06  
Alain Verleyen:
Don't double post please.

Sorry i did not find any help thats why i post this 

and i got help if( Open[0] < MovingAvarage && Ask >= MovingAvarage ) but

oder should open only when crossing not later when i remove the > sign its says error

To add comments, please log in or register