Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnPriceChange, Getting Too many Entries per direction!

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

    OnPriceChange, Getting Too many Entries per direction!

    Hello, my name is Roberto.

    Im trying to make a strategy based on the following context:

    If the Volume of Candle [0] is twice as big of Candle[1], in that precise moment EnterLong.

    I have managed to accomplish this, by changing the Calculate. OnPriceChange. But the issue that Im having is that the Entry does 5 or six times in the same candle. Because once the position gets filled then it enters another position in the same candle and I wish only to enter one time in the candle.

    (Im guessing that once it went above twice of the last candle, every time it goes higher is twice as last candle!!! But not sure!.)

    Can you please Help me out


    Calculate = Calculate.OnPriceChange;
    EntriesPerDirection = 1;
    EntryHandling = EntryHandling.UniqueEntries;
    IsExitOnSessionCloseStrategy = true;
    ExitOnSessionCloseSeconds = 30;
    IsFillLimitOnTouch = false;
    MaximumBarsLookBack = MaximumBarsLookBack.TwoHundredFiftySix;
    OrderFillResolution = OrderFillResolution.Standard;
    Slippage = 0;
    StartBehavior = StartBehavior.ImmediatelySubmit;
    TimeInForce = TimeInForce.Gtc;
    TraceOrders = false;
    RealtimeErrorHandling = RealtimeErrorHandling.StopCancelClose;
    StopTargetHandling = StopTargetHandling.PerEntryExecution;
    BarsRequiredToTrade = 20;


    This is What I have on settings!.

    #2
    Hello RobertoPaez,

    Thank you for your post.

    You'd want to use BarsSinceEntryExecution to control whether it can enter again in the same bar:



    Here's a simple example:

    Code:
    protected override void OnBarUpdate()
    {
        if (CurrentBar < BarsRequiredToTrade)
            return;
    
        // Only enter if at least 10 bars has passed since our last entry or we have not yet entered, and our cross condition is true
        if ((BarsSinceEntryExecution() > 10 || BarsSinceEntryExecution() == -1) && CrossAbove(SMA(10), SMA(20), 1))
            EnterLong();
    
    }
    In your case, since you only want to enter if it's not the same bar as the previous entry, you'd want to use:

    if ((BarsSinceEntryExecution() >= 1 || BarsSinceEntryExecution() == -1) && //additional conditions go here)

    Please let us know if we may be of further assistance to you.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    556 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    324 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
    545 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