is it an indicator or an EA ?
if it's an indicator indicators can't place or close ... a trade !
if it's an indicator indicators can't place or close ... a trade !
if it's an EA why all the trouble using a for loop ... ?
after all you don't care what happens on bar shift 2 or 200...
the only thing that matters is the present
use it simple (something like:)
double HA1=iCustom(Symbol(),0,"Heiken_Ashi",2,0); //last bar open double HA2=iCustom(Symbol(),0,"Heiken_Ashi",3,0); //last bar close double HA1a=iCustom(Symbol(),0,"Heiken_Ashi",2,1); //1 before last bar open double HA2a=iCustom(Symbol(),0,"Heiken_Ashi",3,1); //1 before last bar close
if (HA2>HA1 && HA2a<HA1a) Print("HA LONG"," error =",GetLastError()); //(or trade or whatever) if (HA2<HA1 && HA2a>HA1a) Print("HA SHORT"," error =",GetLastError()); // (or trade or whatever)
sky_lc: so, no errors on the long side.
|
|
thank you qjol! As always you nail my questions perfectly. Yes this is meant for an EA. Removing the loop solved it...
WHRoeder, thank you for your observation. That is quite an interesting read... now i know there´s no reason to call GLE.
This way i´m learning, so thank you both for your patience and observations.
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
Hi guys,
i´m a newbie in code. But i´m studying hard.
I´ve been experimenting an EA with heiken ashi and i´m running into some trouble that i´m not able to fix.
All I want it to do is:
if it turns red go short;
if it turns blue (or green whatever) go long;
Maybe this is something i´m not aproaching the right way but:
- here I´m calling the indicator
- here are the buy and sell conditions. As it was not opening short orders I replaced the open orders with Print to get any errors:
this is what i get:
2014.07.21 11:38:17.545 2014.05.29 10:45 HA proj EA 02_2_4 EURUSD,M15: HA LONG error =0
so, no errors on the long side.
but for shorts it won´t even get a message! I even bypassed the code on buy conditions, leaving only short conditions and... nothing! I don´t get it! shouldn´t it work? it´s the same code as the longs but only with signals (<>) reversed!
can anyone see what´s wrong?
thank you