you use shift 0 that's why
try this
MaCurrentMid=iMA(NULL,0,MATrendPeriodMid,0,MODE_EMA,PRICE_CLOSE,1);
MaPreviousMid=iMA(NULL,0,MATrendPeriodMid,0,MODE_EMA,PRICE_CLOSE,2);
MaCurrentLong=iMA(NULL,0,MATrendPeriodLong,0,MODE_EMA,PRICE_CLOSE,1);
MaPreviousLong=iMA(NULL,0,MATrendPeriodLong,0,MODE_EMA,PRICE_CLOSE,2);
try this
MaCurrentMid=iMA(NULL,0,MATrendPeriodMid,0,MODE_EMA,PRICE_CLOSE,1);
MaPreviousMid=iMA(NULL,0,MATrendPeriodMid,0,MODE_EMA,PRICE_CLOSE,2);
MaCurrentLong=iMA(NULL,0,MATrendPeriodLong,0,MODE_EMA,PRICE_CLOSE,1);
MaPreviousLong=iMA(NULL,0,MATrendPeriodLong,0,MODE_EMA,PRICE_CLOSE,2);
doshur:
you use shift 0 that's why
try this
MaCurrentMid=iMA(NULL,0,MATrendPeriodMid,0,MODE_EMA,PRICE_CLOSE,1);
MaPreviousMid=iMA(NULL,0,MATrendPeriodMid,0,MODE_EMA,PRICE_CLOSE,2);
MaCurrentLong=iMA(NULL,0,MATrendPeriodLong,0,MODE_EMA,PRICE_CLOSE,1);
MaPreviousLong=iMA(NULL,0,MATrendPeriodLong,0,MODE_EMA,PRICE_CLOSE,2);
you use shift 0 that's why
try this
MaCurrentMid=iMA(NULL,0,MATrendPeriodMid,0,MODE_EMA,PRICE_CLOSE,1);
MaPreviousMid=iMA(NULL,0,MATrendPeriodMid,0,MODE_EMA,PRICE_CLOSE,2);
MaCurrentLong=iMA(NULL,0,MATrendPeriodLong,0,MODE_EMA,PRICE_CLOSE,1);
MaPreviousLong=iMA(NULL,0,MATrendPeriodLong,0,MODE_EMA,PRICE_CLOSE,2);
Punta wrote >>
0 is always the current bar, and the price change until the bar is finished / closed
1 is the last closed bar before
2 is again 1 before .. etc :-)
I see you are quite interested in a moving average crossover system
you can see my stuff here
http://www.facebook.com/group.php?gid=203994363361
https://www.forex-tsd.com/expert-advisors-metatrader-4/24496-rangerfx.html
you can see my stuff here
http://www.facebook.com/group.php?gid=203994363361
https://www.forex-tsd.com/expert-advisors-metatrader-4/24496-rangerfx.html
EADeveloper:
0 is always the current bar, and the price change until the bar is finished / closed
1 is the last closed bar before
2 is again 1 before .. etc :-)
0 is always the current bar, and the price change until the bar is finished / closed
1 is the last closed bar before
2 is again 1 before .. etc :-)
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
Thank you Punta.
Here are my trading conditions:
// check for long position (BUY) possibility
if(MaPreviousMid<MaPreviousLong && MaCurrentMid>MaCurrentLong)
// should it be closed?
if((MaPreviousMid>=MaPreviousLong && MaCurrentMid<=MaCurrentLong)
||(MaCurrentMid==MaCurrentLong))
// check for short position (SELL) possibility
if(MaPreviousMid>MaPreviousLong && MaCurrentMid<MaCurrentLong)
// should it be closed?
if((MaPreviousMid<=MaPreviousLong && MaCurrentMid>=MaCurrentLong)
||(MaCurrentMid==MaCurrentLong))