Announcement

Collapse
No announcement yet.

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 sjsj2732, Yesterday, 04:31 AM
            0 responses
            35 views
            0 likes
            Last Post sjsj2732  
            Started by NullPointStrategies, 03-13-2026, 05:17 AM
            0 responses
            287 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            286 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            133 views
            1 like
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            95 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Working...
            X