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 CarlTrading, 03-31-2026, 09:41 PM
    1 response
    46 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    22 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    31 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    50 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    42 views
    0 likes
    Last Post CarlTrading  
    Working...
    X