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

Crossing of.

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

    Crossing of.

    In Strategy Builder I have set 2 variables of a high and a low. What I want is to enter as soon as bid or ask crosses this value with an offset. But I get an error message that left and right expressions do not match. Am using on every tick so I do not wait till the close of a bar.
    Thanks.
    Attached Files

    #2
    Hello Trader17,

    I would suggest changing your operator to >, greater than rather than cross above. CrossAbove when referenced from the Builder takes in two data series for its calculations, and GetCurrentBid is not a series.

    Please let us know if you need further assistance.
    Alan P.NinjaTrader Customer Service

    Comment


      #3
      I will try that. I wanted to use the cross instead of > because with every tick that is greater than the high it might try to open multiple positions instead of cross that does not happen with every tick.

      Comment


        #4
        Hello Trader17,

        To avoid having the condition remain true after its crossed above, you could create a Variable in the builder with a default setting of false, include an if statement checking that this variable is false, and upon your condition block becoming true, set this variable to true so that this block will not run again.

        I put together screen shots for how this could be accomplished.

        Please let us know if you need further assistance.
        Attached Files
        Alan P.NinjaTrader Customer Service

        Comment


          #5
          Got it. I do like your idea but am not too good at coding yet. Does the Builder have something like Open Trades/Positions in it? That could be used too as a condition like if Open Position < or = or something similar to stop it from opening trades at every tick.
          Thanks.

          Comment


            #6
            Hello Trader17,

            Yes, within the Strategy folder of the condition builder, you can add a if statement, MarketPosition == MarketPosition.Flat.

            You could also set entries per direction and entry handling, to limit additional calls to EnterLong.

            Please see,



            Please let us know if you need further assistance.
            Alan P.NinjaTrader Customer Service

            Comment


              #7
              Thanks. That should work for me.

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by helpwanted, Today, 03:06 AM
              1 response
              10 views
              0 likes
              Last Post sarafuenonly123  
              Started by Brevo, Today, 01:45 AM
              0 responses
              9 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
              387 views
              1 like
              Last Post Gavini
              by Gavini
               
              Working...
              X