fxDreema

    • Register
    • Login
    • Search
    • Back to the main page
    • Categories
    • Recent
    • Tags
    • Popular
    • Search

    EA for indicators applied to Previous data

    Questions & Answers
    2
    3
    1142
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D
      Deneris last edited by

      Hi,
      I need to get the values of bollinger bands that are built on a mobile medium, which in turn is built on stochastic.
      To recap:

      • Stochastic
           - Moving average
             - Bollinger bands

      That's what I did

      double BufferSto[];                                 //Buffer containing stochastic values
      double BufferiMaExpSto[];                    // Buffer containing the values of the moving average
      double iBandUpMaExpSto=0.0;      // BB Band UPPER
      double iBandDwMaExpSto=0.0;     // BB band DOWN
      
      int OnInit()
        {
        
         ArrayResize(BufferSto,STO_KPeriod);
         ArrayResize(BufferiMaExpSto,IMA_Period);
         
         return(INIT_SUCCEEDED);
        }
      
      void OnTick()
        {
         if (IsNewBar()){
         
         
         for(int i=1; i<STO_KPeriod; i++)  
            
            BufferSto[i-1]              = iStochastic(NULL,0,STO_KPeriod,STO_DPeriod,STO_Slowing,MODE_SMA,1,MODE_MAIN,i);
            
         
         ArraySetAsSeries(BufferSto, true);
         
          for(int i=1; i<IMA_Period; i++) 
            BufferiMaExpSto[i-1]          = iMAOnArray(BufferSto,0,IMA_Period,0,MODE_EMA,i);                                                        
         
            ArraySetAsSeries(BufferiMaExpSto, true);
         
            iBandUpMaExpSto = NormalizeDouble(iBandsOnArray(BufferiMaExpSto,0,BBPeriodMaExpSto,BBDevizioneMaExpSto,0,MODE_LOWER,1),Digits);
         iBandDwMaExpSto  = NormalizeDouble(iBandsOnArray(BufferiMaExpSto,0,BBPeriodMaExpSto,BBDevizioneMaExpSto,0,MODE_UPPER,1),Digits);
      
         }
          if(!IsTradingTime()) return;
      
         }
      

      If I try to print on the video the bandwidth or indicators value I notice that they do not match the values that are on the chart given by the same indicators.
      What am I doing wrong?

      Many thanks in advance

      1 Reply Last reply Reply Quote 0
      • fxDreema
        fxDreema last edited by

        I'm not very good with indicators. I never really understood ArraySetAsSeries() and iMAOnArray(). If anyone else can help...

        1 Reply Last reply Reply Quote 0
        • D
          Deneris last edited by

          iMAOnArray () should give me the value of the moving average and save it in the buffer and makes it from left to right while ArraySetAsSeries () from right to left. The problem is that in mql4 does not seem to be a "native" operation mine.
          But I saw around someone who succeeds in this intent. In my case the value obtained differs from what appears on the chart.

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post

          Online Users

          J
          D
          M
          E
          A
          F
          E

          16
          Online

          146.9k
          Users

          22.4k
          Topics

          122.6k
          Posts

          Powered by NodeBB Forums | Contributors