How to call it in it EA ?
//+------------------------------------------------------------------+ //| test_SDC.mq5 | //| Copyright 2022,fxMeter | //| https://www.mql5.com/en/users/fxmeter | //+------------------------------------------------------------------+ #property copyright "Copyright 2022,fxMeter" #property link "https://www.mql5.com/en/users/fxmeter" #property version "1.00" input int InputStarBar = 0;//StarBar input int InputCalcBars = 120;//Bars for Calculation input double f1=1.0;//Inner Channel Multiplier input double f2=2.0;//Outer Channel Multiplier int handle = -1; //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- //1.create a handle to StandardDeviationChannel handle = iCustom(Symbol(),PERIOD_CURRENT,"StandardDeviationChannel",InputStarBar,InputCalcBars,f1,f2); //2.check whether the handle is created successfully if(handle==INVALID_HANDLE)//failed { Alert("Create a handle to StandardDeviationChannel failed"); return(INIT_FAILED); } //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { //--- double mid_right = GetBufferValue(0,InputStarBar); double top_right = GetBufferValue(1,InputStarBar); double btm_right = GetBufferValue(2,InputStarBar); double mid_left = GetBufferValue(0,InputStarBar+InputCalcBars-1); double top_left = GetBufferValue(1,InputStarBar+InputCalcBars-1); double btm_left = GetBufferValue(2,InputStarBar+InputCalcBars-1); Comment( "mid_left = ",d2s(mid_left)," , ","mid_right = ",d2s(mid_right),"\n", "top_left = ",d2s(top_left)," , ","top_right = ",d2s(top_right),"\n", "btm_left = ",d2s(btm_left)," , ","btm_right = ",d2s(btm_right) ); } //+------------------------------------------------------------------+ double GetBufferValue(int which_buffer,int which_bar) { double tmp[1]= {0}; CopyBuffer(handle,which_buffer,which_bar,1,tmp); return tmp[0]; } //+------------------------------------------------------------------+ //double convert to string string d2s(double x) { return DoubleToString(x,_Digits); }
Files:
test_SDC.mq5
3 kb
Indicators: Standard Deviation Channel MT4
- 2021.08.20
- www.mql5.com
Standard Deviation Channel MT4: Author: Ziheng Zhuang...
it would be ideal, if there is a multi-timeframe version
Amazing!!!
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
Standard Deviation Channel MT5:
A channel based on standard deviation of close price.
Author: Ziheng Zhuang