Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Moving Stops Indicator

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

    Moving Stops Indicator

    THIS IS AN INDICATOR plot

    I am trying to wrap my head around this Moving Stop

    if ((CurrentBar >= 1) && ((Close[0] > Open[0]) && (Close[1] < Open[1])))


    Value[0] = (Low[1] + (-SubtractTicksforLongStop * TickSize));

    the above finds the first instance, but as more Close > Open occur after the red bar of course the stop is NOW na

    How do I approach retaining the STOP at that level until the next RED bar occurs again followed by a GREEN Bar

    thanks​

    Attempt the long way to just write more condition sets, this compiles but creates an LOG error

    if ((CurrentBar >= 1) && ((Close[0] > Open[0]) && (Close[1] < Open[1])))


    Value[0] = (Low[1] + (-SubtractTicksforLongStop * TickSize));

    if ((CurrentBar >= 1) && ((Close[0] > Open[0]) && (Close[1] > Open[1]) && (Close[2] < Open[2])))


    Value[0] = (Low[2] + (-SubtractTicksforLongStop * TickSize));

    if ((CurrentBar >= 1) && ((Close[0] > Open[0]) && (Close[1] > Open[1]) && (Close[2] > Open[2]) && (Close[3] < Open[3])))


    Value[0] = (Low[3] + (-SubtractTicksforLongStop * TickSize));​

    ERROR error on calling OnBarUpdate method on bar 1. You are accessing an index with a value that is invalid since it is out of range.

    Thanks
    Last edited by DTSSTS; 06-23-2023, 12:05 PM.

    #2
    Disregard overcome

    Comment

    Latest Posts

    Collapse

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