- Magic Number Identifier EA
- No errors but buy/sell orders are not sending
- Ask!
僅附加原始碼 mq4/5 檔案。
I did not have the Chandelier Exit source code files.
i doubt that the sell trades have met your conditions due to the code. search this site for "indicator handle" and you should always Normalise your prices if you have used math or custom calculations.
i doubt that the sell trades have met your conditions due to the code. search this site for "indicator handle" and you should always Normalise your prices if you have used math or custom calculations.
Here are some snippets from a different indicator's code. You will have to edit the variables, handle names, buffers, and logic to suit your code but it should give you the general layout.
On the global scope:
int handle_ma_now; int handle_iatr; int handle_istddev; double ma_now[]; double iatr[]; double istddev[];
In Deinit():
void OnDeinit(const int reason) { if(handle_ma_now != INVALID_HANDLE) IndicatorRelease(handle_ma_now); if(handle_istddev != INVALID_HANDLE) IndicatorRelease(handle_istddev); if(handle_iatr != INVALID_HANDLE) IndicatorRelease(handle_iatr); }
In OnInit():
SetIndexBuffer(7, ma_now, INDICATOR_CALCULATIONS); SetIndexBuffer(8, iatr, INDICATOR_CALCULATIONS); SetIndexBuffer(9, istddev, INDICATOR_CALCULATIONS); handle_ma_now = iCustom(NULL, 0, "Custom_Moving_Average_sep_win", fast_period, 0, fast_period_method, Price_Constant); handle_istddev = iCustom(NULL, 0, "StdDev_sep_win", slow_period, 0, slow_period_method, Price_Constant); handle_iatr = iCustom(NULL, 0, "ATR_sep_win", slow_period, Price_Constant);
In OnCalculate():
if(CopyBuffer(handle_ma_now, 0, 0, copyBars, ma_now) <= 0 || CopyBuffer(handle_istddev, 0, 0, copyBars, istddev) <= 0 || CopyBuffer(handle_iatr, 0, 0, copyBars, iatr) <= 0) slow_array[bar] = istddev[bar] - iatr[bar]; if(ma_now[bar] >= ma_now[bar+1] && move_array[bar] >= min_move) { up_hist[bar] = slow_array[bar]; }
Note that there is no NormalizeDouble() code here because price data is already normalized in the called indicators (not attached).
if(PriceInfo[0].open > belowlin && PriceInfo[0].open > AveragValue) if( PositionsTotal()<=0){ trade.Buy(Size_1, NULL, Ask, 0, PriceInfo[0].close + TPSL*2, NULL)&& ........ } else if(PriceInfo[0].open < uplin && PriceInfo[0].open < AveragValue) { if(PositionsTotal()<=0){ trade.Sell(Size_1, NULL, Bid, 0, PriceInfo[0].close - TPSL*2, NULL)&& ...... } }
but both coding the same logic
but both coding the same logic
because in your code you do not have handles. take especial note of Ryans response. I also recommend that you look in codebase for any ea. In an ea that uses indicators you will see how to use handles that will give you your signals.
Your code as it is, does not meet the signal conditions that you think.
EMA = iDEMA (_Symbol, _Period, DEMA_Period, 0, PRICE_CLOSE);does not give a price or ema price.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use