Login Page - Create Account

Support Board


Date/Time: Thu, 06 Mar 2025 12:53:22 +0000



Post From: Study only Accurate/Visible after Full Calculation ?

[2022-01-30 15:27:06]
SelimEker - Posts: 13
When thinking about sparing you with useless, here i am giving you the full bean. As you mention the first if doesnt go through but there are other to catch up.

However i think i found the problem. Since this code is running multiples time per bar the DownLegCounter is incrementing tons of time.
While coding my brain thought it would run only once per bar.

As for the why it works when doing full recalculation is because during that the code is run only once per bar !!!!!! DAMN i spent two days, i think i got it now.

Hopefully i come back and confirm my theory once i find a way to make it work :D

First try will be with: sc.GetBarHasClosedStatus() == BHCS_BAR_HAS_CLOSED hoping the indexes are not being shifted.



if ( (highOld > high) && (highOld > highOld2) && (SwingLatestHigh >= highOld) ) // Clear Peaks Lower than Last Swing -> New Leg
    {
      DownLegCounter = DownLegCounter + 1;
      SwingLatestHigh = highOld;
    }
    else if ( (highOld > high) && (highOld > highOld2) && (SwingLatestHigh < highOld) ) // Clear Peaks Higher than last Swing -> Reset Leg
    {
      DownLegCounter = 1;
      SwingLatestHigh = highOld;
    }
    else if( (highOld > high) && (highOld == highOld2) && (highOld3 < highOld2) && (SwingLatestHigh >= highOld) ) // Double Peak -> New Leg
    {
      DownLegCounter = DownLegCounter + 1;
      SwingLatestHigh = highOld;
    }
    else if( (highOld > high) && (highOld == highOld2) && (highOld3 < highOld2) && (SwingLatestHigh < highOld) ) // Double Peak -> Reset
    {
      DownLegCounter = 1;
      SwingLatestHigh = highOld;
    }
    else if ( (highOld > high) && (highOld == highOld2) && (highOld2 == highOld3) && (highOld4 < highOld3) && (SwingLatestHigh >= highOld) ) // Triple Peak -> New Leg
    {
      DownLegCounter = DownLegCounter + 1;
      SwingLatestHigh = highOld;
    }
    else if ( (highOld > high) && (highOld == highOld2) && (highOld2 == highOld3) && (highOld4 < highOld3) && (SwingLatestHigh < highOld) ) // Triple Peak -> Reset
    {
      DownLegCounter = 1;
      SwingLatestHigh = highOld;
    }

    


    // If high(i) < high(i-1) AND DownLegCounter = 2


    if ( (high < highOld) && (DownLegCounter == 2) )
    {
      Subgraph_LONG[sc.Index] = high;
      LowestLongPrice = high;
    }
    else if ( (high == LowestLongPrice) && (DownLegCounter == 2) )
    {
      Subgraph_LONG[sc.Index] = high;
    }
    else
    {
      Subgraph_LONG[sc.Index] = 0;



    }