Premium3 468x60 forex
Page 17 of 28 FirstFirst ... 7 15 16 17 18 19 27 ... LastLast
Results 161 to 170 of 279
Like Tree70Likes

AllPivots

This is a discussion on AllPivots within the Trading tools forums, part of the Trading Forum category; Hi Igor, One question, why we are using 22 AvgPeriod and not 1? I saw the difference in levels but ...

          
   
  1. #161
    Senior Member
    Join Date
    Jul 2014
    Posts
    612
    Hi Igor,

    One question, why we are using 22 AvgPeriod and not 1?

    I saw the difference in levels but not getting the clear idea, why?

    Regards,
    Jag

    Quote Originally Posted by igorad View Post
    Hi Jagardish,

    Sorry but I see from your template for the AllPivots_v4.5 that the parameter AvgPeriod is equal 1 instead of 22.


    Regards,
    Igor

  2. #162
    Developer igorad's Avatar
    Join Date
    Feb 2013
    Posts
    2,101
    Follow igorad On Twitter Add igorad on Facebook Add igorad on Google+
    Add igorad on Linkedin
    Quote Originally Posted by jagadish123 View Post
    Hi Igor,

    One question, why we are using 22 AvgPeriod and not 1?

    I saw the difference in levels but not getting the clear idea, why?

    Regards,
    Jag
    Hi Jag,

    I suppose because 22 is number of working days per month.

    Regards,
    Igor

  3. #163
    Senior Member
    Join Date
    Jul 2014
    Posts
    612
    Oh... ok. Got you. Thanks

    Quote Originally Posted by igorad View Post
    Hi Jag,

    I suppose because 22 is number of working days per month.

    Regards,
    Igor

  4. #164
    Senior Member
    Join Date
    Jul 2014
    Posts
    612
    Hi Igor,

    When tried with M15, getting array error

    2017.11.07 20:29:02.665 AllPivots_v5.0 600+ GBPJPYi,M15: array out of range in 'AllPivots_v5.0 600+.mq4' (266,28)

    DOTS Method Levels(BasePrice=Current Open)


    Please help.


    Regards,
    Jag


    Quote Originally Posted by igorad View Post
    Hi,

    Please check out the updated AllPivots indicator for MT4 and MT5.
    It's important update because I fixed and improved the Floor Pivots formula. So now you can enter any sequences of the pivots (eg. PivotValues = "0;1;2;3;4;5;6" instead of "0;1;2;3;4" for previous versions). Also I did some improvements for visuality of the pivots' values for larger timeframes.


    Attachment 28903


    Regards,
    Igor
    Last edited by jagadish123; 11-07-2017 at 02:05 PM.

  5. #165
    Developer igorad's Avatar
    Join Date
    Feb 2013
    Posts
    2,101
    Follow igorad On Twitter Add igorad on Facebook Add igorad on Google+
    Add igorad on Linkedin
    Quote Originally Posted by jagadish123 View Post
    Hi Igor,

    When tried with M15, getting array error

    2017.11.07 20:29:02.665 AllPivots_v5.0 600+ GBPJPYi,M15: array out of range in 'AllPivots_v5.0 600+.mq4' (266,28)

    DOTS Method Levels(BasePrice=Current Open)


    Please help.


    Regards,
    Jag
    Hi Jag,

    Usually it happens when not enough bars are on the chart to build a certain kind of pivots especially for the large timeframes (>MN1). So you should apply the indicator on M30 or H1 or download more history for the chart.


    Regards,
    Igor

  6. #166
    Senior Member
    Join Date
    Jul 2014
    Posts
    612
    Thanks Igor. This is resolved now.

  7. #167
    Member ape_epa's Avatar
    Join Date
    Nov 2014
    Location
    Padova(IT)
    Posts
    99
    Quote Originally Posted by igorad View Post
    Hi,

    Please check out the updated AllPivots indicator for MT4 and MT5.
    It's important update because I fixed and improved the Floor Pivots formula. So now you can enter any sequences of the pivots (eg. PivotValues = "0;1;2;3;4;5;6" instead of "0;1;2;3;4" for previous versions). Also I did some improvements for visuality of the pivots' values for larger timeframes.


    Attachment 28903


    Regards,
    Igor
    Hi igorad! Can you check the mt5 version? It's working but can't get the right values in the buffers. I tried to adjust them in the source code but the indicator keeps all the values to 0.0 all the time(I see it in Data Window). Maybe I'm missing something obvious but seems like I can't put any value in the buffers.

    Thanks in advance! :-)
    Last edited by ape_epa; 12-11-2017 at 02:55 AM. Reason: typo

  8. #168
    Developer igorad's Avatar
    Join Date
    Feb 2013
    Posts
    2,101
    Follow igorad On Twitter Add igorad on Facebook Add igorad on Google+
    Add igorad on Linkedin
    Quote Originally Posted by ape_epa View Post
    Hi igorad! Can you check the mt5 version? It's working but can't get the right values in the buffers. I tried to adjust them in the source code but the indicator keeps all the values to 0.0 all the time(I see it in Data Window). Maybe I'm missing something obvious but seems like I can't put any value in the buffers.

    Thanks in advance! :-)
    Hi ape_epa,

    Please check out the updated AllPivots indicator for MT5 which can be used in EAs.


    AllPivots-allpivots_v5_1-mt5.png



    In the EA settings you should add the following piece of code:

    Code:
    input string            pivotsInputs               = "===== AllPivots settings: =====";
    input ENUM_TIMEFRAME    pivotsTimeFrame            =       D1;    // TimeFrame 
    input string            pivotsUniqueName           =  "Floor";    // Unique Name
    input int               pivotsLength               =        1;    // Length in periods(eg. 2= 2 days)  
    input ENUM_PIVOTS       pivotsMode                 = floor_piv;   // Pivot Mode  
    input string            pivotsValues               = "0;1;2;3;4"; // Pivot values(ratios)
    input ENUM_BASEPRICE    pivotsBasePrice            = prevtypical; // Base Price
    input int               pivotsBaseHourShift        =        0;    // Base Hour Shift(eg.0-start of the day)
    input bool              pivotsShowMedians          =    false;    // Show Medians 
    input ENUM_RANGE        pivotsRangeMode            =   hilo_r;    // Range Mode
    input int               pivotsAvgPeriod            =        1;    // Avg Period in bars  
    input int               pivotsSessionStartHour     =        0;    // Session Start Hour(eg. 9 for DAX,0-for Forex)
    input int               pivotsSessionEndHour       =        0;    // Session End Hour(eg. 22 for DAX,0-for Forex)
    input int               pivotsNumberOfDigits       =        4;    // Number of digits after decimal point 
    input bool              pivotsShowPivots           =     true;    // Show Pivots
    input int               pivotsEntryMode            =        1;    // Entry Mode: 0-off,1-r1/s1,2-r2/s2,3-r3/s3   
    
    
    bool              ShowGradientColor          =  true;                //Show Gradient Colors
    color             MainPivotColor             =  clrWhite;            //Main Pivot Color
    int               MainPivotWidth             =  2;                   //Main Pivot Width
    color             UpperLevelColor            =  clrYellowGreen;      //Upper Level Color         
    color             LowerLevelColor            =  clrFireBrick;        //Lower Level Color
    ENUM_LINE_STYLE   LineStyle                  =  STYLE_SOLID;         //Line Style
    int               LineWidth                  =  1;                   //Line Width                   
    ENUM_LINE_STYLE   MedianStyle                =  STYLE_DOT;           //Median Style
    int               MedianWidth                =  0;                   //Median Width
    bool              ShowPivotValues            =  false;               //Show Pivot Values(true/false)
    string            FontName                   =  "Arial";             //Font Name
    int               FontSize                   =  8;                   //Font Size
    ENUM_DESCPLACE    DescriptionPlace           =  left;                //Description Place
    bool              ShowComment                =  false;               //Show Comments
    bool              ShowPeriodSeparators       =  true;                //Show Period Separators
    color             PeriodSeparatorsColor      =  clrGray;             //Period Separators Color
    Also before the settings you should add the needed ENUMs from the indicator.

    Code:
    enum ENUM_TIMEFRAME
    {
       Current  =        0,  // Current
       M1       =        1,  // M1
       M2       =        2,  // M2  
       M3       =        3,  // M3
       M4       =        4,  // M4  
       M5       =        5,  // M5
       M10      =       10,  // M10
       M12      =       12,  // M12  
       M15      =       15,  // M15
       M30      =       30,  // M30
       H1       =       60,  // H1
       H2       =      120,  // H2
       H3       =      180,  // H3
       H4       =      240,  // H4
       H6       =      360,  // H6
       H8       =      480,  // H8
       H12      =      720,  // H12   
       D1       =     1440,  // D1
       W1       =    10080,  // W1
       MN1      =    43200,  // MN1
       YR1      =   525600   // YR1
    };
    
    
    enum ENUM_PIVOTS
    {
       off_piv,             // Off
       floor_piv,           // Floor (BasePrice=Previous Typical)
       camarilla,           // Camarilla (BasePrice=Previous Close)    
       demark,              // Demark's Pivots
       fibo_rel,            // Fibo relative or Avg Range Levels
       fibo_abs,            // Fibo absolute(in pips)
       woodie,              // Woodie's Pivots(BasePrice=Previous Weighted Open)
       dots                 // DOTS Method Levels(BasePrice=Current Open)
    };
    
    enum ENUM_RANGE
    {
       hilo_r,              // High/Low Range
       updn_r,              // UpRange=High-BasePrice, DnRange=BasePrice-Low 
       close_r              // Range=Close-Close[1]
    };
    
    enum ENUM_BASEPRICE
    {
       prevclose,           // Previous Close
       curopen,             // Current Open 
       curmedian,           // Current Median
       prevhigh,            // Previous High   
       prevlow,             // Previous Low   
       prevmedian,          // Previous Median    
       prevtypical,         // Previous Typical  
       prevwclose,          // Previous Weighted Close      
       prevwopen            // Previous Weighted Open
    };
    
    enum ENUM_DESCPLACE
    {
       off,                 // off
       left,                // on the left      
       middle,              // in the middle  
       right                // on the right   
    };
    In the OnInit() should be added:

    Code:
       if(pivotsMode != off_piv)
       {
       handle_pivots = iCustom(_Symbol,0,"AllPivots_v5_1","",pivotsTimeFrame,pivotsUniqueName,pivotsLength,pivotsMode-1,pivotsValues,pivotsBasePrice,pivotsBaseHourShift,pivotsShowMedians,pivotsRangeMode,pivotsAvgPeriod,pivotsSessionStartHour,pivotsSessionEndHour,pivotsNumberOfDigits,
                               "",pivotsShowPivots,ShowGradientColor,MainPivotColor,MainPivotWidth,UpperLevelColor,LowerLevelColor,LineStyle,LineWidth,MedianStyle,MedianWidth,
                               ShowPivotValues,FontName,FontSize,DescriptionPlace,ShowComment,ShowPeriodSeparators,PeriodSeparatorsColor);
       
          if(handle_pivots == INVALID_HANDLE)
          {
          if(DebugModeOn) Print("Error in loading of AllPpivots. LastError = ",GetLastError());
          return(-1);
          }
       
       ArrayResize(pp,1); ArraySetAsSeries(pp,true);
       ArrayResize(r1,1); ArraySetAsSeries(r1,true); 
       ArrayResize(r2,1); ArraySetAsSeries(r2,true);
       ArrayResize(r3,1); ArraySetAsSeries(r3,true);
       ArrayResize(r4,1); ArraySetAsSeries(r4,true);
       ArrayResize(r5,1); ArraySetAsSeries(r5,true);
       ArrayResize(r6,1); ArraySetAsSeries(r6,true);   
       ArrayResize(s1,1); ArraySetAsSeries(s1,true);
       ArrayResize(s2,1); ArraySetAsSeries(s2,true);
       ArrayResize(s3,1); ArraySetAsSeries(s3,true);
       ArrayResize(s4,1); ArraySetAsSeries(s4,true);
       ArrayResize(s5,1); ArraySetAsSeries(s5,true);
       ArrayResize(s6,1); ArraySetAsSeries(s6,true);  
       }
    As an example to call the AllPivots you should use the function:

    Code:
    double pp[], r1[], r2[], r3[], r4[], r5[], r6[], 
                 s1[], s2[], s3[], s4[], s5[], s6[];   
    
    MqlRates rates[];
    
    int allPivots(int mode)
    {
       ArraySetAsSeries(rates,true); 
       int copied = CopyRates(_Symbol,0,0,2,rates); 
       
       if(CopyBuffer(handle_pivots, 0,0,1,pp) < 0) return(0);  
       if(CopyBuffer(handle_pivots, 1,0,1,r1) < 0) return(0); 
       if(CopyBuffer(handle_pivots, 2,0,1,r2) < 0) return(0);
       if(CopyBuffer(handle_pivots, 3,0,1,r3) < 0) return(0);
       if(CopyBuffer(handle_pivots, 4,0,1,r4) < 0) return(0); 
       if(CopyBuffer(handle_pivots, 5,0,1,r5) < 0) return(0);
       if(CopyBuffer(handle_pivots, 6,0,1,r6) < 0) return(0);
       if(CopyBuffer(handle_pivots, 7,0,1,s1) < 0) return(0); 
       if(CopyBuffer(handle_pivots, 8,0,1,s2) < 0) return(0);
       if(CopyBuffer(handle_pivots, 9,0,1,s3) < 0) return(0);
       if(CopyBuffer(handle_pivots,10,0,1,s4) < 0) return(0); 
       if(CopyBuffer(handle_pivots,11,0,1,s5) < 0) return(0);
       if(CopyBuffer(handle_pivots,12,0,1,s6) < 0) return(0);
       
       if(mode == 0) return(0);  
       
       switch(mode)
       {
       case 1:  if(rates[0].close < s1[0] && s1[0] > 0) return( mode);
                if(rates[0].close > r1[0] && r1[0] > 0) return(-mode); 
                break; 
       
       case 2:  if(rates[0].close < s2[0] && s2[0] > 0) return( mode);
                if(rates[0].close > r2[0] && r2[0] > 0) return(-mode); 
                break; 
       
       case 3:  if(rates[0].close < s3[0] && s3[0] > 0) return( mode);
                if(rates[0].close > r3[0] && r3[0] > 0) return(-mode); 
                break; 
       }
       
       return(0);
    }
    Regards,
    Igor
    Attached Files Attached Files
    ape_epa likes this.

  9. #169
    Member ape_epa's Avatar
    Join Date
    Nov 2014
    Location
    Padova(IT)
    Posts
    99
    @igorad: thank you for the indicator and for the detailed explanation. The indicator is good and usable in EAs. But I want to know why the buffers still contain zeros in all candles/positions but the first. Since the line is plotted to the chart why the buffers can't be filled accordingly? I still have the buffer with correct values on last bar but the other bars have 0.000000

  10. #170
    Developer igorad's Avatar
    Join Date
    Feb 2013
    Posts
    2,101
    Follow igorad On Twitter Add igorad on Facebook Add igorad on Google+
    Add igorad on Linkedin
    Quote Originally Posted by ape_epa View Post
    @igorad: thank you for the indicator and for the detailed explanation. The indicator is good and usable in EAs. But I want to know why the buffers still contain zeros in all candles/positions but the first. Since the line is plotted to the chart why the buffers can't be filled accordingly? I still have the buffer with correct values on last bar but the other bars have 0.000000
    Hi ape_epa,

    As you can see in the AllPivots we can fill the external buffers only for the current bar and it's enough to be used in EAs.


    Regards,
    Igor

Page 17 of 28 FirstFirst ... 7 15 16 17 18 19 27 ... LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •