Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

changing plot

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

    changing plot

    hi i added some lines to the indicator attached below to 1 for long and -1 for short and is working but I'm wondering if there's a way that i can modified the code that i can plot the signal 1 candle prior this is the lines i added (285, 286, 306, 307)

    Attached Files

    #2
    Hello fgs092790,

    For the plot to be set 1 candle before it is now the condition would have to be true 1 bar earlier. While you can set a previous bars plot value for visual purposes that would not be reflected if you are using the value for a signal in another script. If you do want to set a previous plot value you would just use [1] bars ago when setting the plot.

    Regarding the code you added, if you plan to use that as a signal for a strategy your public property needs to be defined like the following which uses Update:

    Code:
    private int trade; 
    
    public int Trade
    {
         // We need to call the Update() method to ensure our exposed variable is in up-to-date.
        get { Update(); return trade; }
    }​

    Comment


      #3
      how woud i change the condition to make it one bar ago i been looking at the code for a while but i can figure out how to do it?

      Comment


        #4
        Hello fgs092790,

        That would depend on how you want the logic to work, I couldn't really provide a specific answer on that. If the indicator is plotting in a specific way now the only way to have its plot happen 1 bar earlier would be to change its logic in a way that you can detect that 1 bar earlier.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        46 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        67 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        35 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        95 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        59 views
        0 likes
        Last Post PaulMohn  
        Working...
        X