if((down && harami && (Open[shift+2]>Close[shift+2]) && (Open[shift+1]>Close[shift+2]) && (Close[shift+1]<Open[shift+2]) && (Close[shift+1]>Open[shift+1]) && (iOpen(Symbol(),PERIOD_H1, [shift]) > iClose(Symbol(),PERIOD_H1, [shift] )) ?
Since shift is defined to 0 in, can i make it like above? 0 is current candle?
tkaboris:
thanks i read.
How can i make PERIOD_H1 as a variable so i can change timeframes to backtest it?
so it looks something like
if (iOpen(Symbol(), var,0) > iClose(Symbol(), var,0))
extern int var = PERIOD_H1;

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello,
Can sombody help me to add additional condition for opening? I want to add condition to make sure larger time frame candle, h1, Open>Close. Basically, i have expert that opens by candlestick formation, but i wanted to make sure larger timeframe candle is bullish/bearish for buy/sell signals.
Here is piece of my code, thanks
extern bool harami=true;extern int shift=0; // bar in the past to take in consideration for the signal
int signal=0;
if((down && harami && (Open[shift+2]>Close[shift+2]) && (Open[shift+1]>Close[shift+2]) && (Close[shift+1]<Open[shift+2]) && (Close[shift+1]>Open[shift+1]))
|| (cross && (Open[shift+2]>Close[shift+2]) && (Open[shift+1]>Close[shift+2])&& (Open[shift+1]<Open[shift+2])&& (Close[shift+1]>Open[shift+2]))
|| (engulf && (Close[shift+2]<Open[shift+2]) && (Open[shift+1]<Close[shift+2]) && (Close[shift+1]>Open[shift+2]))
|| (pierce && (Close[shift+2]<Open[shift+2]) && (Close[shift+1]>Open[shift+1]) && ((Open[shift+1]<Close[shift+2])) && (Close[shift+1]>Close[shift+2]+((Open[shift+2]-Close[shift+2])/2)))
|| (morningstar && (Close[shift+3]<Open[shift+3]) && (Open[shift+2]<Close[shift+3]) && (Close[shift+2]<Close[shift+3]) && ((Open[shift+1]>Close[shift+2]) && (Open[shift+1]>Open[shift+2])) && (Close[shift+1]>=Close[shift+3]))
|| (hammer && (Open[shift+1]-Low[shift+1]>MathMax(High[shift+1]-Close[shift+1],Close[shift+1]-Open[shift+1])*3) && (Close[shift+1]-Low[shift+1]>MathMax(High[shift+1]-Close[shift+1],Close[shift+1]-Open[shift+1])*3))