EA
- Is this possible??? Indicator x Indicator (Bar shift +1)
- Automated BUY SELL based off great Indictor
- Do I need mql4 code to create ea?
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); } //} }