Here is how the code should look in MQL5:
int handle_iCustom; double array_up[]; ArraySetAsSeries(array_up, true); //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- create handle of the indicator iCustom handle_iCustom=iCustom(Symbol(),Period(),"NAME INDICATOR"); //--- if the handle is not created if(handle_iCustom==INVALID_HANDLE) { //--- tell about the failure and output the error code PrintFormat("Failed to create handle of the iCustom indicator for the symbol %s/%s, error code %d", Symbol(), EnumToString(Period()), GetLastError()); //--- the indicator is stopped early return(INIT_FAILED); } //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { int buffer_num=0,start_pos=0,count=6; if(CopyBuffer(handle_iCustom,buffer_num,start_pos,count,array_up)!=count) return; if(array_up[1]!=EMPTYVALUE && CalculateAllPositions()) { //Open order Buy } }
Thanks for your feedback!!
i tried it but still no trades..
all Eas placed trades except this.. and not a single journal error
code
string indi="arrow_Signal"; int indicator_handle; double slswing[],buyarw[],sellarw[]; int OnInit() { indicator_handle= iCustom(Symbol(), Period(),indi); if(indicator_handle==INVALID_HANDLE) { //--- tell about the failure and output the error code PrintFormat("Failed to create handle of the iCustom indicator for the symbol %s/%s, error code %d", Symbol(), EnumToString(Period()), GetLastError()); //--- the indicator is stopped early return(INIT_FAILED); } void OnTick() { int count=6; if(CopyBuffer(indicator_handle, 0, 0, count, buyarw) !=count) return; if(CopyBuffer(indicator_handle, 1, 0, count, sellarw) !=count) return; if(CopyBuffer(indicator_handle, 8, 0, count, slswing) !=count) return; ArraySetAsSeries(buyarw,true); ArraySetAsSeries(sellarw,true); ArraySetAsSeries(slswing,true); if(buyarw[1]!=EMPTY_VALUE) { //Open order Buy } }
still no trades..
i tried to use another ma1 above ma2 =buy and it works..
theere is no journal errors, it runs on strategy
tester.. but not a single order placed!!!
- www.mql5.com
ArraySetAsSeries
added it on global variable it returns error.. supposed to be on global variable..?
and again the
EMPTY_VALUE
yours looks like this
EMPTYVALUE
supposed to be EMPTYVALUE?
added it on global variable it returns error.. supposed to be on global variable..?
and again the
yours looks like this
supposed to be EMPTYVALUE?
EMPTYVALUE is my typo.
Are you sure you need to check bar # 1? Are you sure you need to check for equality EMPTY_VALUE? In general, your indicator is needed.
EMPTYVALUE is my typo.
Are you sure you need to check bar # 1? Are you sure you need to check for equality EMPTY_VALUE? In general, your indicator is needed.
Hi.. i tried it but not working..
i used a sample from the below code and get it working
here
bool need_open_buy=(iCustomGet(handle_iCustom,0,1)==0.0)?false:true; bool need_open_sell=(iCustomGet(handle_iCustom,1,1)==0.0)?false:true; if(CalculateAllPositions()==0.0) { if(need_open_buy) { double sl=(InpStopLoss==0)?0.0:m_symbol.Ask()-ExtStopLoss; double tp=(InpTakeProfit==0)?0.0:m_symbol.Ask()+ExtTakeProfit; OpenBuy(sl,tp); } else if(need_open_sell) { double sl=(InpStopLoss==0)?0.0:m_symbol.Bid()+ExtStopLoss; double tp=(InpTakeProfit==0)?0.0:m_symbol.Bid()-ExtTakeProfit; OpenSell(sl,tp); } } else { if(need_open_buy) ClosePositions(POSITION_TYPE_SELL); else if(need_open_sell) ClosePositions(POSITION_TYPE_BUY); Trailing(); }Thanks a lot for your feedback
Hi.. i tried it but not working..
i used a sample from the below code and get it working
here
I don’t understand - why are you asking about "EMPTY_VALUE"? Indeed, the indicator uses the value "0.0" - "0.0" is an empty value.
Second: amend the indicator:
//---- превращение динамического массива в индикаторный буфер SetIndexBuffer(1,BuyBuffer,INDICATOR_DATA); //---- осуществление сдвига начала отсчета отрисовки индикатора 2 PlotIndexSetInteger(1,PLOT_DRAW_BEGIN,StartBars); //--- создание метки для отображения в DataWindow PlotIndexSetString(1,PLOT_LABEL,"Buy"); //---- символ для индикатора PlotIndexSetInteger(1,PLOT_ARROW,108); //---- индексация элементов в буфере как в таймсерии ArraySetAsSeries(BuyBuffer,true); //---- запрет на отрисовку индикатором пустых значений PlotIndexSetDouble(1,PLOT_EMPTY_VALUE,0);
I don’t understand - why are you asking about "EMPTY_VALUE"? Indeed, the indicator uses the value "0.0" - "0.0" is an empty value.
Second: amend the indicator:
HI..
i didn't use this indicator.. i only used the codes in the EA.. to make mine
my indicator is different!! and i only have access to the .ex5 format..
but i got it working using this code
bool need_open_buy=(iCustomGet(handle_iCustom,0,1)==0.0)?false:true; bool need_open_sell=(iCustomGet(handle_iCustom,1,1)==0.0)?false:true;
Thanks again..
HI..
i didn't use this indicator.. i only used the codes in the EA.. to make mine
my indicator is different!! and i only have access to the .ex5 format..
but i got it working using this code
Thanks again..
Please do not constantly change the terms of the question :)
I have already given you several options that work. And even fixed the indicator that you are using (post # 5 )
Now I finally do not understand: what are you doing and what do you want to receive. My advice: formulate your task, do not change the task constantly, provide an indicator code and an advisor code, ask a question.
- 2020.03.10
- www.mql5.com
Please do not constantly change the terms of the question :)
I have already given you several options that work. And even fixed the indicator that you are using (post # 5 )
Now I finally do not understand: what are you doing and what do you want to receive. My advice: formulate your task, do not change the task constantly, provide an indicator code and an advisor code, ask a question.
Ohh am sorry.. Next time
Thanks a lot for your time and feedback
appreciated a lot..
:)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi..
in mql4
How do i make it in mql5
not opening order, am i doing the right thing?