Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

To draw only today not historic lookback; Builder

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

    To draw only today not historic lookback; Builder

    I made a feeble attempt in the builder to have drawing for 'Today Only'
    Need help please.

    (This is building on top of an ongoing strat/Indicator support assist, but this one is on time series)

    Click image for larger version

Name:	2024-11-04 12_21_11-2024_11_04_12_20_05_Strategy_Builder.png.png
Views:	75
Size:	21.1 KB
ID:	1323637 Click image for larger version

Name:	2024-11-04 12_23_30-Chart - 5m RTH.png
Views:	73
Size:	48.8 KB
ID:	1323638

    #2
    Hello trdninstyle,

    Thank you for your post.

    When is Today_Only set to false? The only logic shown here is that Draw.Rectangle is called when Today_Only is true. If there is no logic to change Today_Only to false, Today_Only will always be true.

    If you don't want the strategy to process on historical data, a simple solution would be to unlock the script and add the following to the top of OnBarUpdate:

    if (State == State.Historical) return;

    Comment


      #3
      Hello Gaby,

      I have the same script unlocked and one in the builder so I can go back & forth. I want to have the ability to select 'Today Only' and then not today only but my full lookback.
      So, I should have Today Only as false then? In the Inputs. Or as false in the Variables? Bool.

      Comment


        #4
        " I want to have the ability to select 'Today Only' and then not today only but my full lookback."

        I'm not sure what you are saying here - can you provide more details? What do you mean by "not today only but my full lookback"?

        "So, I should have Today Only as false then? In the Inputs. Or as false in the Variables? Bool."

        The conditions should have the ability to flip the bool between true and false. If you aren't explicitly stating in the logic of code when the bool should be true/false then the value of the bool isn't going to change. Meaning if you set the default value of Today_Only to true and have no logic to set it to false, it will always stay true and vice versa.

        Comment


          #5
          "The conditions should have the ability to flip the bool between true and false."

          Yes, thats what I'm attempting to do.

          I need to explicitly state for the logic of my code to be true or false, apparently I'm not doing that.

          Here's a bar counter with the true false option for today only then if left unchecked it counts bars as far back as the lookback.

          I'm sorry if I'm not understanding right now which is very basic to anyone else. If I could locate someone demonstrating this condition on u-tube I'll get it.

          Click image for larger version

Name:	2024-11-04 13_25_00-Chart - 5m RTH.png
Views:	78
Size:	22.6 KB
ID:	1323654








          Comment


            #6
            I looked inside the script for this bar counter indicator, I would like to do this in Builder then copy it into the unlocked script.

            Click image for larger version  Name:	2024-11-04 13_35_43-NinjaScript Editor - Indicator - BarCounterThree.png Views:	0 Size:	14.5 KB ID:	1323657 Click image for larger version  Name:	2024-11-04 13_36_16-NinjaScript Editor - Indicator - BarCounterThree.png Views:	0 Size:	6.3 KB ID:	1323658

            Comment


              #7
              Hello,

              I'm not familiar with that indicator, but if it achieves the logic you're looking for then you could incorporate it into your own unlocked script.

              Comment


                #8
                I'm going to try that then, but what are the steps to OnlyPlotToday in the builder ? I'm going to express it that way, sounds better.

                Comment


                  #9
                  This specific code you've posted can't be accomplished in the Builder, it would need to be manually coded.

                  Comment


                    #10
                    I pasted in items from that bar counter script, here's the screenshots. If you really feel like helping me that would be awesome.

                    I had errors but I worked through them it compiles at this point but will not load.



                    Click image for larger version

Name:	2024-11-04 15_21_16-NinjaScript Editor - Strategy - SupportResistanceUnlocked.png
Views:	70
Size:	9.0 KB
ID:	1323692

                    Click image for larger version

Name:	2024-11-04 15_21_46-NinjaScript Editor - Strategy - SupportResistanceUnlocked.png
Views:	44
Size:	11.5 KB
ID:	1323693

                    Click image for larger version

Name:	2024-11-04 15_22_19-NinjaScript Editor - Strategy - SupportResistanceUnlocked.png
Views:	43
Size:	11.7 KB
ID:	1323694



                    Comment


                      #11
                      The PlotIndy items I had all in there but it errored I removed them & it compiled, Somehow I need to place those back. ??

                      Comment


                        #12
                        I adjusted the curly brackets and now the PlotIndy works without showing an error, please see 2nd pic.

                        When I open up Strategy on the chart I get ...

                        Click image for larger version

Name:	2024-11-04 18_43_18-Chart - 5m RTH.png
Views:	58
Size:	4.5 KB
ID:	1323700



                        Comment


                          #13
                          Hello,

                          Is this error only occurring when you add your own strategy to the chart?

                          Or, are you able to replicate it by adding the SampleMACrossover?

                          Comment


                            #14
                            Hi Gaby,

                            Yes, it was from adding my own strategy to the chart, I removed the PlotTodayOnly items & that fixed it.

                            I'm going to over the weekend take that BarCounterThree, make a copy then start removing various parts compiling it along the way, until I have mostly the PlotTodayOnly left then begin to add one piece at a time from my other script into it. Essentially build my script into that one, because I can't bring 'plot today only' into it on the front end, I''ll go the back way. Try at least.

                            Last edited by trdninstyle; 11-05-2024, 07:25 AM.

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                            0 responses
                            599 views
                            0 likes
                            Last Post Geovanny Suaza  
                            Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                            0 responses
                            344 views
                            1 like
                            Last Post Geovanny Suaza  
                            Started by Mindset, 02-09-2026, 11:44 AM
                            0 responses
                            103 views
                            0 likes
                            Last Post Mindset
                            by Mindset
                             
                            Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                            0 responses
                            558 views
                            1 like
                            Last Post Geovanny Suaza  
                            Started by RFrosty, 01-28-2026, 06:49 PM
                            0 responses
                            557 views
                            1 like
                            Last Post RFrosty
                            by RFrosty
                             
                            Working...
                            X