Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

managing trades outside trade window

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

    managing trades outside trade window

    i am havign a session between 5 pm est to next day 5 pm est.
    however i want to manage a trade window inside this so i can programatically change it.

    this is my logic. appreciate input if i missed something.
    private bool TradeWithinTimeframe()
    {
    DateTime currTime=currentTime();
    bool goTrade=false;
    if(currTime.Hour>1 && currTime.Hour<15)
    {
    goTrade=true;
    }
    else
    {
    // close open positions.
    if Position.MarketPosition != MarketPosition.Flat){
    Position.Close();
    }
    // cancel open orders

    Position.Account.CancelAllOrders(this.Instrument);

    }
    return goTrade;


    }

    #2
    Hello,

    I responded to your email a moment ago - just be aware that the strategy position and account position may not be in sync and it's possible that the strategy is flat but the account is not.

    I will allow for any other members to comment here for any unsupported suggestions they may have for checking your account position.
    MatthewNinjaTrader Product Management

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by ZeroKuhl, Today, 04:31 PM
    0 responses
    7 views
    0 likes
    Last Post ZeroKuhl  
    Started by Vulgoth_t_Destroyer, 05-09-2022, 04:45 PM
    54 responses
    5,336 views
    0 likes
    Last Post Gaterz
    by Gaterz
     
    Started by ETFVoyageur, 05-07-2024, 07:05 PM
    11 responses
    74 views
    0 likes
    Last Post -=Edge=-  
    Started by _Zero_, 04-10-2020, 03:21 PM
    145 responses
    7,899 views
    6 likes
    Last Post johng2
    by johng2
     
    Started by TheTradingMantis, 01-19-2023, 02:05 AM
    43 responses
    921 views
    0 likes
    Last Post jmagaia
    by jmagaia
     
    Working...
    X