Is it possible to write an EA that recognises a buy or sell arrow created by a 2 moving averages indictor, and buys or sells on that? When an EA creates the moving averages within itself it is never anywhere near the result of the indicator.
- Is this possible??? Indicator x Indicator (Bar shift +1)
- Do I need mql4 code to create ea?
- Stops
A moving average is an indicator. You just said EA trades with moving averages. Therefor "it is possible to write an EA that recognizes ... of an indicator." Your words.
Just get the value(s) of the indicator(s) into the EA and do what you want with it.
You should encapsulate your iCustom calls to make your code self-documenting.
Detailed explanation of iCustom - MQL4 and MetaTrader 4 - MQL4 programming forum
Just get the value(s) of the indicator(s) into the EA and do what you want with it.
You should encapsulate your iCustom calls to make your code self-documenting.
Detailed explanation of iCustom - MQL4 and MetaTrader 4 - MQL4 programming forum
Ea is not trading "the chart". Ea is trading the data/quotes.
besides, what you see on the chart (arrow on open bar which may be disappeared) and what EA is trading (arrow on previous bar which can not be disappeared) - are two different "stories" in some cases.
So, it is better to understand some programming logic (to understand how EA shoud work).
or to improve your EA
Something like this might get you started (mql5):
void OnTick() { static datetime LastBar = 0; datetime ThisBar = (datetime)SeriesInfoInteger(_Symbol,PERIOD_CURRENT,SERIES_LASTBAR_DATE); int NumBars = SeriesInfoInteger(_Symbol,PERIOD_CURRENT,SERIES_BARS_COUNT); //if(LastBar != ThisBar) // { LastBar = ThisBar; //Print("NB " + NumBars); double indicator_1[], indicator_2[]; int buy_ = CopyBuffer(indicator_handle,0,0,NumBars,indicator_1); ArraySetAsSeries(indicator_1,true); //Print(TimeToString(ThisBar + " " + buy_ + " " + indicator_1[NumBars-1])); //Print (ThisBar + " " + "buy_ " + buy_ + " " + NumBars + " " + indicator_1[0]); //Print (ThisBar + " -1 " + "buy_ " + buy_ + " " + NumBars + " " + indicator_1[1]); int sell_ = CopyBuffer(indicator_handle,1,0,NumBars,indicator_2); ArraySetAsSeries(indicator_2,true); //Print (ThisBar + " " + "sell_ " + sell_ + " " + NumBars + " " + indicator_2[0]); //Print (ThisBar+ " -1 " + "sell_ " + sell_ + " " + NumBars + " " + indicator_2[1]); if((double)indicator_1[0] >1 ) { Print (ThisBar + " " + "buy: " + indicator_1[0]); //place_order("BUY 1 - MKT 10000 10000", "", true); } if((double)indicator_2[0] >1 ) { Print (ThisBar + " " + "sell: " + indicator_2[0]); //place_order("SELL 1 - MKT 10000 10000", "", true); } //} }

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