Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

variables to reset every day.

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

    variables to reset every day.




    people with nt,



    i have been trying to incorporate the concretum bands indicator into some of my strategies.



    i want to define variables to indicate whether price has closed outside of the bands at any point during a trading session (lower than, higher than or either). this value should be valid for the remainder of the session and then all variables should be set to false when the session is over.


    i thought this structure below should work but the results have been nonsensical as the strategy places all kinds of trades every day, when it should only place trades on at most half of the sessions and sometimes only short, sometimes only long and rarely in both directions.



    ¿is there any better way to define variables that indicate the states i have described?


    if (Bars.IsFirstBarOfSession)
    {

    var01 = false;
    var02 = false;
    var03 = false;

    }


    if (Closes[1][0] < cb1.Lowerband[0])
    {

    var01 = true;
    var03 = true;

    }


    if (Closes[1][0] > cb1.Upperband[0])
    {

    var02 = true;
    var03 = true;

    }​



    very well, regards.

    #2
    Hello rtwave,

    Thank you for your post.

    I'm not seeing anything obviously wrong with these conditions - they will reset on the first bar of the new session, and will be set from false to true based on your conditions comparing the Close of the secondary data series to the lower and upper band values.

    In order to better understand how the code is working, it will be necessary to use Print to see how the conditions are evaluating and enable TraceOrders to see if orders are being submitted, ignored, rejected, or cancelled.

    I'm also including a link to a forum post with further suggestions on debugging a script.


    Enable TraceOrders, print the time of the bar and all values used in the conditions that submit entry orders. Include labels for all values and comparison operators.

    Let me know if you need any assistance creating a print or enabling TraceOrders.

    Save the output from the output window to a text file and provide this with your reply.

    I'll be happy to assist with analyzing the output.​

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    116 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    61 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    40 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    43 views
    0 likes
    Last Post TheRealMorford  
    Started by Mindset, 02-28-2026, 06:16 AM
    0 responses
    82 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X