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 fx.practic, 10-15-2013, 12:53 AM
              5 responses
              5,406 views
              0 likes
              Last Post Bidder
              by Bidder
               
              Started by Shai Samuel, 07-02-2022, 02:46 PM
              4 responses
              98 views
              0 likes
              Last Post Bidder
              by Bidder
               
              Started by DJ888, Yesterday, 10:57 PM
              0 responses
              8 views
              0 likes
              Last Post DJ888
              by DJ888
               
              Started by MacDad, 02-25-2024, 11:48 PM
              7 responses
              160 views
              0 likes
              Last Post loganjarosz123  
              Started by Belfortbucks, Yesterday, 09:29 PM
              0 responses
              9 views
              0 likes
              Last Post Belfortbucks  
              Working...
              X