• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to Reset using BarsSinceExitExecution

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

    How to Reset using BarsSinceExitExecution

    My logic for BarsSinceEntryExecution is working but it seems my integer variable StopBars is not being reset to 0 upon a position exit before my SetStopLoss method call.

    if (BarsSinceEntryExecution()>=0)
    {
    StopBars=BarsSinceEntryExecution();
    }
    else
    {
    StopBars=0;
    }

    // I'm trying to reset my ticks calculation here.
    if (BarsSinceExitExecution()==0)
    {
    StopBars=0;
    }
    DynamicStopTicks=Some Function using StopBars as a Variable);
    SetStopLoss("", CalculationMode.Ticks,DynamicStopTicks, true);
    Last edited by DuggyLou; 04-08-2017, 07:07 AM.

    #2
    I thought about it during the night and I realize that the call of BarsSinceEntryExecution is overwriting the StopBars value on the next OnBarUpdate call. Should be a simple fix by setting a flag once I reset StopBars and modifying my if then statement. looking for whether my flag has been set or not. Thanks

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by cirzonorkecv, Yesterday, 11:52 PM
    0 responses
    6 views
    0 likes
    Last Post cirzonorkecv  
    Started by rickyblah12, Yesterday, 01:01 PM
    1 response
    14 views
    0 likes
    Last Post Erwin Beckers  
    Started by dadarara, Yesterday, 12:18 PM
    0 responses
    8 views
    0 likes
    Last Post dadarara  
    Started by joemiller, Yesterday, 07:33 AM
    2 responses
    13 views
    0 likes
    Last Post joemiller  
    Started by TheGameOfProbabilities, 07-18-2019, 06:56 AM
    7 responses
    38 views
    0 likes
    Last Post DaveS
    by DaveS
     
    Working...
    X