Hi
Check for errors in jornal, print out MA & ST just before test and check all parameters are present and correct for indicator calls especially iCustom. It is good practice to check returned value of functions like ObjectCreate. I'm not sure what happens if you leave off parameters in a function call. C would complain but MT4 just carries on and doesn't tell you so be vigilant.
To be on the safe side:
ObjectCreate("Arrow", OBJ_ARROW, 0, Time[0], Ask);
ObjectSet("Arrow", OBJPROP_ARROWCODE, 140);
ObjectSet("Arrow", OBJPROP_COLOR, Yellow);
Your parameters create an arrow at date == 1 and price == 1.
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
would anyone care to advise me why this piece of code doesnt work?
double MA=iMA(NULL,0,1,0,MODE_SMA,PRICE_CLOSE,0);
double ST=iCustom(Symbol(),0,"SuperTrend",10,3,0);
if (MA<ST)
{
ObjectCreate("Arrow", OBJ_ARROW,0,1,1);
Alert("Arrow created?");
}
Im trying to detect if the Super trend indicator is above or below the 1 period MA, but I am not getting an arrow drawn or an alert created.
Im just getting started with MQL4, so any help would be greatly appreciated
Thanks