Converting idea into indicator

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #186837 quote
    DilwynEvs
    Participant
    New

    Good afternoon All

     

    I’ve done a bit of basic indicator coding – bar colour changes etc but I presume that the attached is more related to arrays etc ???  beyond me at the moment.

    If anybody can make sense of the attached and point me in the right direction and any pitfalls I need to be aware of .

     

    Thanks in advance

    Capture-3.jpg Capture-3.jpg
    #186952 quote
    robertogozzi
    Moderator
    Master

    Can you explain in details what your pic shows, to be able to better understand what you need?

    #186963 quote
    DilwynEvs
    Participant
    New

    I’ve been working on the code and I’ve got it working.

    I’ve gone as far as 10 bars at the moment – is there a simpler way rather than generating longer formula for each line ??

     

    My stopping point at the moment is setting a minimum number of results through input value – its giving me random results ??

     

    Thanks in advance

     

        if  ((NewThree    == true)    &&     (H2>H1)&&(H2>H3)  &&  (H4 >C2)&&(H4 <H2)&&(H4 >H5 )  &&  (H4 >H3) )
         
         {     HighH4  = 1  ;  }
         
         if  ((NewThree    == true)    &&     (H2>H1)&&(H2>H3)  &&  (H5 >C2)&&(H5 <H2)&&(H5 >H6 )  &&  (H5 >H3)&&(H5 >H4) )                         
    
         {     HighH5  = 1  ;  } 
         
         if  ((NewThree    == true)    &&     (H2>H1)&&(H2>H3)  &&  (H6 >C2)&&(H6 <H2)&&(H6 >H7 )  &&  (H6 >H3)&&(H6 >H4)&&(H6 >H5) ) 
    
         {     HighH6  = 1  ;  } 
                                                                                                             
         if  ((NewThree    == true)    &&     (H2>H1)&&(H2>H3)  &&  (H7 >C2)&&(H7 <H2)&&(H7 >H8 )  &&  (H7 >H3)&&(H7 >H4)&&(H7 >H5)&&(H7> H6) )                                                                                             
    
         {     HighH7  = 1  ;  } 
                    
         if  ((NewThree    == true)    &&     (H2>H1)&&(H2>H3)  &&  (H8 >C2)&&(H8 <H2)&&(H8 >H9 )  &&  (H8 >H3)&&(H8 >H4)&&(H8 >H5)&&(H8> H6)&&(H8 > H7) )
    
         {     HighH8++  ;  } 
          
         if  ((NewThree    == true)    &&     (H2>H1)&&(H2>H3)  &&  (H9 >C2)&&(H9 <H2)&&(H9 >H10)  &&  (H9 >H3)&&(H9 >H4)&&(H9 >H5)&&(H9> H6)&&(H9 > H7)&&(H9 > H8) )
    
         {     HighH9++  ;  } 
               
         if  ((NewThree    == true)    &&     (H2>H1)&&(H2>H3)  &&  (H10>C2)&&(H10<H2)&&(H10>H11)  &&  (H10>H3)&&(H10>H4)&&(H10>H5)&&(H10>H6)&&(H10> H7)&&(H10> H8)&&(H10> H9) )
    
         {     HighH10 = 1  ;  } 
                   
         if  ((NewThree    == true)    &&     (H2>H1)&&(H2>H3)  &&  (H11>C2)&&(H11<H2)&&(H11>H12)  &&  (H11>H3)&&(H11>H4)&&(H11>H5)&&(H11>H6)&&(H11> H7)&&(H11> H8)&&(H11> H9)&&(H11> H10) )
    
         {     HighH11 = 1  ;  } 
                                
                                                                                                  
     
    uchar       HighH_Total = HighH4 + HighH5 + HighH6 + HighH7 + HighH8 + HighH9 + HighH10 + HighH11 ;
         
           
           
         
        if  ((NewThree    == true)    &&     (HighH_Total >= MinimumCount))     
                                              
        {     val3[shift3]=High[shift3];      val4[shift3]=Low[shift3];
          
              HighH4=0; HighH5=0; HighH6=0; HighH7=0; HighH8=0; HighH9=0; HighH10=0; HighH11=0 ; }
    2022-DilwynEvs-V2.mq4 Capture-8.png Capture-8.png
    #186972 quote
    DilwynEvs
    Participant
    New

    The idea is working on the peaks of the highs as per attachment

    Criteria’s as follows

    1.Previous Peaks – cant be higher than the peak being tested

    2. Previous Peaks – cant be lower than any bar that’s been previous

    3. Previous Peaks – cant be lower than peak test bar close

    4.  This can happen on numerous occasions  until we go above the test peak high

     

    5. Once finished a minimum peaks criteria needs to be met before the test peak candle can be highlighted.

     

    Hope it makes more sense

    Thanks in advance

    #187202 quote
    DilwynEvs
    Participant
    New

    A bit more learning over the weekend

    Can anybody highlight what basic errors are stopping this loop from working ?

     

    /*
    input bool   PeakTest  = true;                           //------------------ Highlighting Inputs used---------------------//
    input bool   PeakTest1 = true;
    
    input uchar MinimumCount      = 2 ;
    input uchar ScanMaxCount      = 10;
    */      
    
    
    
    int        i, BarCount= 0;  
               
    double     A1,   A2,   A3  ;
    double     HighestHigh = High[4], HighBar = High[3], Total = 1;
                     
    
    for         (i=4;  i<=ScanMaxCount-1;  i++)          //  4<=10  :  i=5  need to scan till criteria met : from Bar[4] to Bar[10]       // From zero (!) to..
    {
    if         ((PeakTest1 == true) && (H2>H1)&&(H2>H3)&&(H2>H4)                                                                          // Initial Test
                            
    &&         ((HighestHigh<H2)        == true))                  {          HighBar     = High[i];                                      // If test is met HighBar = High[4] :                                  
    {
    if         ((HighestHigh>HighBar)   == true)                   {          HighestHigh = High[i];                                      // If High[4]>High[3]  :  HighestHigh = [4]                         
    {                               
    if         ((HighestHigh>C2)        == true)                   {          A1 = High[i--];  A2 = High[i];  A3 = High[i++];             // If High[4]>Close[2] :  A1 = High[3]   A2 = High[4]   A3 = High[5]   
    {
    if        (((A2>A1)&&(A2>A3))       == true)                   {          BarCount++;                                                 // If High[4]>High[3] && High[4]>High[5] : Bar Count = 1    
    {
    if         ((BarCount>MinimumCount) == true)                   {          val4[shift3]=High[shift3];   val3[shift3]=Low[shift3];      // If 1>10 :  Highlight Bar[2]                           
     
    }}}}}                                                                                                                                 // Continue testing until criteria is met
    }}}}
    }
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.

Converting idea into indicator


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
DilwynEvs @dilwynevs Participant
Summary

This topic contains 4 replies,
has 2 voices, and was last updated by DilwynEvs
4 years ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 01/28/2022
Status: Active
Attachments: 3 files
Logo Logo
Loading...