Hello Fellow Traders;
I am writing an EA and basically have it done…but I am having issues getting the exit command correct.
I am using multiple indicators to open the position.
To be exact the follow indicators must agree for a buy or sell;
Short Ema vs Long Ema, RSI, MACD w/ Signal, and PSAR.
I would like the exit to happen when any of those above signals disagree.
so in basic terms it would read:
Close “Buy” position if:
SARCurrent>Bid OR Rsi<50 OR MacdCurrent<0 OR SignalCurrent<0 OR ShortEma<LongEma
Problem is that as far as i can tell MQL4 doesnt accept the “OR” command…would I substitute it with the “else” command…I have the rest of the code figured out and this is the last peice of the puzzle before I can test.
Could anybody assist with this command ?
Thank you.
Ok, another Riddle…at least it is to me.
Is there a way I can attatch an EA to a 15 min Chart, but have it pull information from a 4H indicator…for example, if I were using a Simple Crossover Method on a 15 min chart, but I only want the cross to place a buy order if the 4H char agrees that it is an upward market…it would look something like this…
15 Min Ema:
15_short_ema=iMA(NULL,0,5,0,1,0,0);
15_long_ema=iMA(NULL,0,10,0,1,0,0);
4 Hour Ema:
int i4h
i4h=iBarShift(NULL,PERIOD_H4,iTime(NULL,0,i),true)+1;
4H_short_ema=iMA(NULL,PERIOD_H4,5,0,MODE_EMA,PRICE_CLOSE,i4h);
4H_long_ema=iMA(NULL,PERIOD_H4,10,0,MODE_EMA,PRICE_CLOSE,i4h);
if (15_short_ema > 15_long_ema && 4H_short_ema > 4h_long_ema)
open buy order.
would anyone be able to tell what I am doing wrong with this, or possibily offer a solution to using indicators from a different time frame? I am working with alot more indicators that EMA, but w/ a basic idea I could probally make it work.