Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Coding structure questions

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Coding structure questions

    Hello. I have the following code in my OnBarUpdate() method:

    Code:
      if (UpTriangleTimeTakenConverted <= 10000)
        {
            //LASTUPCARAT    
            lastupcarattimetaken = Now.Subtract(lastupcarat);
            if (lastupcarattimetaken <= SpanThreshold)
            {
               
            }
            //LASTUPDOT
            lastupdottimetaken = Now.Subtract(lastupdot);
            if (lastupdottimetaken <= SpanThreshold)
            {
                upprobability++;
            }
            //PRICEBELOWBLUE
            pricebelowbluetimetaken = Now.Subtract(pricebelowblue);
            if (pricebelowbluetimetaken <= SpanThreshold)
            {
                upprobability++;
            }
            //YELBELOWBLUE
            yelbelowbluetimetaken = Now.Subtract(yelbelowblue);
            if (yelbelowbluetimetaken <= SpanThreshold)
            {
                upprobability++;
            }         
            //print arrows*upprobability
    So the value of upprobability will determine how many times I want to print an up arrow. More than 1 arrow per bar should print each subsequent arrow underneath the last arrow by about 2-3 pips. Any idea how I can dynamically structure this statement to accomplish the task? Right now, the y values are hard coded.

    Code:
        DrawArrowUp("Up Arrow5_1" + CurrentBar, 0, Low[0] - .0009, Color.Green);    
            DrawArrowUp("Up Arrow5_2" + CurrentBar, 0, Low[0] - .00012, Color.Green);
            DrawArrowUp("Up Arrow5_3" + CurrentBar, 0, Low[0] - .00015, Color.Green);
            DrawArrowUp("Up Arrow5_4" + CurrentBar, 0, Low[0] - .00018, Color.Green);
            DrawArrowUp("Up Arrow5_4" + CurrentBar, 0, Low[0] - .00021, Color.Green);

    #2
    This is the correct logic
    Code:
    if (UpTriangleTimeTakenConverted <= 10000) 
        { 
            upprobability++; 
            //LASTUPCARAT     
            //Timespan lastupcaratdt=lastupcarat; 
             
            lastupcarattimetaken = Now.Subtract( lastupcarat); 
            if (lastupcarattimetaken <= SpanThreshold) 
            { 
               upprobability++; 
            } 
            //LASTUPDOT 
            lastupdottimetaken = Now.Subtract(lastupdot); 
            if (lastupdottimetaken <= SpanThreshold) 
            { 
                upprobability++; 
            } 
            //PRICEBELOWBLUE 
            pricebelowbluetimetaken = Now.Subtract(pricebelowblue); 
            if (pricebelowbluetimetaken <= SpanThreshold) 
            { 
                upprobability++; 
            } 
            //YELBELOWBLUE 
            yelbelowbluetimetaken = Now.Subtract(yelbelowblue); 
            if (yelbelowbluetimetaken <= SpanThreshold) 
            { 
                upprobability++; 
            }          
            
            //print arrows*upprobability 
            float x=.0006F; 
            for (int h=0; h<=upprobability; upprobability--) { 
                 x+=.003F;             
                DrawArrowUp("Up Diamond2_1" + x, 0, Low[0] - x, Color.Green);     
                 
            }
    ---------
    last up carat vars are defined like this:

    private TimeSpan lastupcarat=TimeSpan.FromSeconds(2);
    private TimeSpan lastupcarattimetaken=TimeSpan.FromSeconds(0);


    On this line:

    lastupcarattimetaken = Now.Subtract( lastupcarat);

    I get error: Cannot implicitly convert System.DateTime to System.Timespan

    Comment


      #3
      Unfortunately this is beyond the level of support we offer - did you check into MSDN already? I would guess lastupcarat needs to be DateTime instead of TimeSpan though...

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      607 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      353 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      105 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      560 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      561 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X