Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Previous price on "On Price Change" strategy

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

    Previous price on "On Price Change" strategy

    A buy order will be executed when the following is met

    The current price (Close[0]) is 1 tick higher than the previous closed bar's high (High[1])
    +
    the previous price (Close[??]) was equal to the previous bar's high (High[1]).

    How do I point to the previous price change since Close[1] would point to the previous bar, not the previous price change?

    Thanks!

    #2
    Hello Ousher, thanks for writing in.

    You can keep track of the last changed price by saving the last price at the end of OnBarUpdate e.g:

    Code:
    private double lastPrice = -1;
    protected override void OnBarUpdate()
    {
    Print("lastPrice " + lastPrice);
    Print("Close[0] " + Close[0]);
    Print("");
    
    if(Close[0] != lastPrice)
    lastPrice = Close[0];
    }
    Best regards,
    -ChrisL

    Comment

    Latest Posts

    Collapse

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