Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

strategies interdependencies

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

    strategies interdependencies

    Hello,

    I want to ask please if there are interdependencies that might cause issues when running 2 scripts on same instrument, eg one script in a range chart and another script in a tickchart. Both scripts in onbarupdate there is the check if flat or long or short. Can there be some issue with stops or with conditions because of the other script maybe?

    I use different ordernames:
    entryOrderSr1a=EnterShort(4,1, "rS1a"); // strategy running in a range-chart
    entryOrderTSr1a=EnterShort(4,1, "TrS1a"); // strategy running in a tick-chart

    It seems there is an issue with my lines I´m working with (for catching pivots, moving stops...) that I remote with my customized buttons. When I moved the line in one chart it doesnt work in the other chart anymore. I have in onbarupdate
    if(shortlinedraw==false)
    {
    if(storeshort>0 && (Closes[4][0]>Lows[4][0]-1*TickSize || Closes[4][0]<Highs[4][0]+1*TickSize) && shortlinedraw==false)
    {TxShortLine = Draw.HorizontalLine(this, "TxShortLine", true, Highs[4][0]+2*TickSize, Brushes.DeepPink, DashStyleHelper.Dash,2);shortlinedraw=true;TxShort Line.IsLocked=false;}
    }
    if(shortlinedraw==true)
    {
    if (DrawObjects["TxShortLine"] != null && DrawObjects["TxShortLine"] is DrawingTools.HorizontalLine)
    {
    shortlinePrice = Instrument.MasterInstrument.RoundToTickSize(TxShor tLine.StartAnchor.Price);
    shortlinevalue = shortlinePrice;
    }}​

    I could build this from the helpguide. Do I have to add something so that when I move the line it does not have impact on the line in the other script?


    Thank you!
    Tony​
    Last edited by tonynt; 08-24-2024, 09:26 AM. Reason: translation error

    #2
    Hello tonynt,

    Strategies do not know what other strategies are doing so they can submit conflicting actions and become out of sync. If you need to run two strategies on the same instrument it is suggested to combine the logic into one strategy and just run that.

    Regarding your lines I couldn't say what may be happening there, have you tried to debug the code using prints? A script can only manage its own lines so if you are drawing from two scripts you would need to make sure to use unique tag names for each scripts lines.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by NullPointStrategies, Today, 05:17 AM
    0 responses
    44 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    124 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    65 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    42 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    46 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X