iMA not loading New comment [Deleted] 2023.04.07 09:12 #property version "1.00" #property indicator_chart_window #property indicator_buffers 1 #property indicator_plots 0 int handle; int hix,lix,lvb,_fvb,_clb,fvb=-1,clb=-1; double buff[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- indicator buffers mapping SetIndexBuffer(0,buff,INDICATOR_CALCULATIONS); handle = iMA(NULL,0,12,0,MODE_SMA,MODE_CLOSE); //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { //--- FindHighLow(); ArrayResize(buff,(MathMax(hix,lix))+1); CopyBuffer(handle,0,MathMin(hix,lix),((MathMax(hix,lix)-MathMin(hix,lix))),buff); // for //--- return value of prev_calculated for next call return(rates_total); } //| Find HighLow on Visible Chart Window | //+------------------------------------------------------------------+ void FindHighLow() { _fvb=(int)ChartGetInteger(ChartID(),CHART_FIRST_VISIBLE_BAR,0); _clb=(int)ChartGetInteger(ChartID(),CHART_WIDTH_IN_BARS,0); if (_fvb>0 &&(_fvb!=fvb||_clb!=clb)) { lvb=_fvb-(_clb-1); if (lvb<0) { lvb=0; } hix= iHighest(NULL,0,MODE_HIGH,(_fvb-lvb),lvb); // Highest Index of High lix= iLowest(NULL,0,MODE_LOW,(_fvb-lvb),lvb); // Highest Index of Low ChartRedraw(ChartID()); //then we store the following to track changes fvb=_fvb; clb=_clb; } } //+------------------------------------------------------------------+ I am trying to Load iMA between high and low on scrolling chart but its not appearing on chart, here is my code thanks New comment
I am trying to Load iMA between high and low on scrolling chart but its not appearing on chart, here is my code
thanks