Hi, Scriptor. This is a nice indicator. Could you please create a similar indicator based on LWMA and EMA?
FX-Navigator :
Hi, Scriptor. This is a nice indicator. Could you please create a similar indicator based on LWMA and EMA?
Hi, Scriptor. This is a nice indicator. Could you please create a similar indicator based on LWMA and EMA?
Scriptor doesn't answer anyone for a long time. But you can correct the code yourself:
//+------------------------------------------------------------------+ //| Custom indicator initialisation function | //+------------------------------------------------------------------+ int OnInit() { //--- set global variables period=int(InpPeriod<1 ? 1 : InpPeriod); period_ma=int(InpPeriodMA<1 ? 1 : InpPeriodMA); deviation=InpDeviation; //--- indicator buffers mapping SetIndexBuffer(0,BufferTop,INDICATOR_DATA); SetIndexBuffer(1,BufferBottom,INDICATOR_DATA); SetIndexBuffer(2,BufferMA,INDICATOR_DATA); SetIndexBuffer(3,BufferMirror,INDICATOR_DATA); SetIndexBuffer(4,BufferMA1,INDICATOR_CALCULATIONS); SetIndexBuffer(5,BufferMAInd,INDICATOR_CALCULATIONS); //--- setting indicator parameters IndicatorSetString(INDICATOR_SHORTNAME,"MBands("+(string)period+","+(string)period_ma+","+DoubleToString(deviation,1)+")"); IndicatorSetInteger(INDICATOR_DIGITS,Digits()); //--- setting buffer arrays as timeseries ArraySetAsSeries(BufferTop,true); ArraySetAsSeries(BufferBottom,true); ArraySetAsSeries(BufferMA,true); ArraySetAsSeries(BufferMirror,true); ArraySetAsSeries(BufferMA1,true); ArraySetAsSeries(BufferMAInd,true); //--- create MA's handle ResetLastError(); handle_ma=iMA(NULL,PERIOD_CURRENT,period_ma,0,MODE_SMA,InpAppliedPrice); if(handle_ma==INVALID_HANDLE) { Print("The iMA(",(string)period_ma,") object was not created: Error ",GetLastError()); return INIT_FAILED; } ResetLastError(); handle_ma1=iMA(NULL,PERIOD_CURRENT,1,0,MODE_SMA,InpAppliedPrice); if(handle_ma1==INVALID_HANDLE) { Print("The iMA(1) object was not created: Error ",GetLastError()); return INIT_FAILED; } ResetLastError(); handle_ma_ind=iMA(NULL,PERIOD_CURRENT,period,0,MODE_SMA,InpAppliedPrice); if(handle_ma_ind==INVALID_HANDLE) { Print("The iMA(",(string)period,") object was not created: Error ",GetLastError()); return INIT_FAILED; } //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+
Instead of MODE_SMA, enter the desired MODE_EMA or MODE_LWMA
Artyom Trishkin:
Thanks. I did what you told me, but it did not change.
Scriptor doesn't answer anyone for a long time. But you can correct the code yourself:
Instead of MODE_SMA, enter the desired MODE_EMA or MODE_LWMA
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
Mirror_Bands:
Interpretation of the indicator:
Enter a long position, when the MA line crosses the Mirror line upwards
Enter a short position, when the MA line crosses the Mirror line downwards
Author: Scriptor