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

NT8 Strategy

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

    NT8 Strategy

    Hello,

    I created a new NT8 strategy that I want to run through an optimization in the Strategy Analyzer.

    It is basically a 15 minute price bar breakout and then pullback strategy, that - for a long trade - needs high up volume after the pullback and for the price to be above the 15 EMA, before a long entry. And the inverse is true for a short trade.

    I want to be sure that the code that I created will do what I think it will do. I have specific comments for each section of the code.

    I had to unlock this strategy, to add some custom code, so I cannot open it in the Strategy Builder. I thought I added a stop-loss, but I cannot find it in the code and forgot what amount my stop is, if it is there. And if I cannot find it, then I cannot change it [my bad :-( ]

    The .cs file for this strategy is attached. A screenshot of the main code for this strategy is also attached.

    Can someone please let me know if what I stated in my comments are what the code is programmed to do?

    If instead I coded this incorrectly or differently from what I thought it will do, please let me know.

    Thanks,
    Attached Files

    #2
    Hello i2w8am9ii2,

    I am not showing that SetStopLoss() is called any where in the script.

    Below is a public link to the help guide on SetStopLoss().


    Your logic looks mostly correct from the comments that are added. I am noticing that VolumeUpDown1.UpVolume[0] is being used instead of Volume[0].
    The VolumeUpDown1.UpVolume[0] will not have a value and will return a 0 if volume is down volume (and vice versa) while the Volume[0] would be populated for every bar.
    You may want to look at .IsValidDataPoint() to ensure that you are using the value when intended.

    Below is a public link to the help guide.


    Also, your comment 'previous 5 minute bar + 200%' doesn't seem to reflect the code:
    (VolumeUpDown1.DownVolume[1] * 2)
    Multiplying by 2 wouldn't be 200% that would be 100%.
    Multiplying by 3 would be 200%.

    Examples:
    Increase 100 by %10
    1 + .10 * 100 = 110
    Increase 100 by %50
    1 + .50 * 100 = 150
    Increase 100 by %100
    1 + 1 * 100 = 200
    Increase 100 by %200
    1 + 2 * 100 = 300
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hi Chelsea,

      Thanks for your reply and for the explanations. I appreciate it.

      So if I understand correctly, I could change the volume code to the following:

      && (VolumeUpDown1.Volume[0] >= (VolumeUpDown1.Volume[1] * 3) )

      && (VolumeUpDown1.Volume[0] >= (VolumeUpDown1.Volume[1] * 3) )


      But if I do so, then would I need to change the name or anything else in the parameters that I created in the #region Properties area?

      Comment


        #4
        Hello i2w8am9ii2,

        No this would not need or cause any property names to change.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Great. Thanks so much again for your help Chelsea.

          One more question... attached is a screenshot of a static stop-loss and profit target that I added, is that code placed correctly?

          Comment


            #6
            Hello i2w8am9ii2,

            It is fine to set a stop loss and profit target in State.Configure.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Hi Chelsea,

              Great. Thanks for letting me know.

              And thanks for looking through all my code earlier. I appreciate your help very much.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Brevo, Today, 01:45 AM
              0 responses
              6 views
              0 likes
              Last Post Brevo
              by Brevo
               
              Started by aussugardefender, Today, 01:07 AM
              0 responses
              5 views
              0 likes
              Last Post aussugardefender  
              Started by pvincent, 06-23-2022, 12:53 PM
              14 responses
              242 views
              0 likes
              Last Post Nyman
              by Nyman
               
              Started by TraderG23, 12-08-2023, 07:56 AM
              9 responses
              384 views
              1 like
              Last Post Gavini
              by Gavini
               
              Started by oviejo, Today, 12:28 AM
              0 responses
              6 views
              0 likes
              Last Post oviejo
              by oviejo
               
              Working...
              X