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

No action within the first 10 minutes.

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

    No action within the first 10 minutes.

    Hello,
    my strategy is in place.
    I'd like to add something in the coding script for reallive trading and also for backtest.
    I work on intraday 3 minutes charts, I don't what the strategy to take the first signal of the day to avoid false trading signals due to overnight, gaps...
    Thanks
    Laurent
    I tried no trade within 10 first minutes but it didn't worked out.
    Last edited by laurent; 04-11-2009, 11:25 PM. Reason: I WRITE my question more precisely

    #2
    Hello,

    I would build a bool flag that swtiches once the first would be signal comes. This may help:

    time_to_trade = false; //put in the initialize block

    //put the code below in the OnBarUpdate() block

    if(...your criteria for placing trade....)
    {
    if(time_to_trade)
    {
    //order placement here
    }
    time_to_trade = true;
    }
    DenNinjaTrader Customer Service

    Comment


      #3
      time_to_trade

      Thanks for your initial answer.
      Unfortunately, unable to do it correctly.
      Is it possible to join the script, it is one published in ninja strategies section to add this function.
      Otherwise, can you tell me more about time_to_trade function, I didn't find it in the help section.
      Laurent.
      Attached Files

      Comment


        #4
        Hello,

        time_to_trade is a made up custom variable I created. Sorry I made a mistake in my last post. You need to add your bool flag variable to the variables section and initialize and declare it there.

        Here are code snippets on how to do it for the long side in the SampleMACross. Just do the same thing for the short side:

        #region Variables
        privateint fast = 10;
        privateint slow = 25;

        privatebool time_to_trade = false;
        #endregion


        if (CrossAbove(SMA(Fast), SMA(Slow), 1))
        {
        if(time_to_trade)
        {
        EnterLong();
        }
        time_to_trade =
        true;
        }
        DenNinjaTrader Customer Service

        Comment


          #5
          Thanks a lot , one last question pls.

          I'd like to add a global stoploss to my strategy and backtest different values of global stoploss in the strategy analyser.
          I added :
          SetStopLoss(500, true); in the Initialize() block
          Where should I add a line to get setstoploss as a parameter in the strategy analyser ?
          Thanks again for your fast and accurate answers.
          Laurent
          Last edited by laurent; 04-12-2009, 11:57 AM.

          Comment


            #6
            Hello,

            So you want the 500 to be a user input parameter? If so, review this link on how to do it:
            DenNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Carolscogginsi, Yesterday, 10:45 PM
            0 responses
            6 views
            0 likes
            Last Post Carolscogginsi  
            Started by RaddiFX, Yesterday, 10:15 AM
            2 responses
            15 views
            0 likes
            Last Post RaddiFX
            by RaddiFX
             
            Started by patrickmlee007, Yesterday, 09:33 AM
            2 responses
            18 views
            0 likes
            Last Post patrickmlee007  
            Started by magnatauren, 08-15-2020, 02:12 PM
            5 responses
            208 views
            0 likes
            Last Post RaddiFX
            by RaddiFX
             
            Started by rene69851, 05-02-2024, 03:25 PM
            1 response
            24 views
            0 likes
            Last Post rene69851  
            Working...
            X