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

Non-programmer needs help

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

    Non-programmer needs help

    Hi, I am trying to create a Ninjascript using the strategy wizard, but I'm having a few problems completing it. I attached the exported file to this post.

    I want to place a long and a short order, at a certain time and a certain date, which would vary, and need to be changed whenever the ninjascript is used. Each order would be a stop limit order offset from the current price by about 10 ticks, and would cancel the other order if it was executed. If executed it would then implement a selected ATM strategy which would work in real time only, as stated in the help file.

    If neither order was executed it i would like to cancel both after a certain time. The ATM strategy would take care of the trade from there. I have attempted to set up a basic version of the ATM strategy using Stop and Profit Targets in the Ninjascript. When I tried to back test it, I got an error message saying that ninjatrader needs to shut down, although it didnt shut down. Can you tell me what is wrong with the script? The wizard said that it completed successfully.


    Is it possible to have user input as part of a Ninjascript, by using an input box? E.g. To set the time and date.

    As a more advanced version I would like to have user input of a number to trigger the trades being set after the time is reached. Would this be possible?

    Thanks,
    Matthew
    Attached Files

    #2
    Hi Matthew,

    You are not allowed to submit two entry orders at the same time. This violates are order handling rules for a strategy. You will have to remove one of these orders and try again.
    RayNinjaTrader Customer Service

    Comment


      #3
      To trade on both sides of the market I've split my strategy into long and short parts, executed independently, If you also wanna submit a pair of orders from each as OCO you'll need a global C# class keeping track of your orders.

      Comment


        #4
        Thanks for the replies. Does this mean I can't submit 2 orders at the same time, even if they'e OCO, or can they be submitted at slightly different times? E.g. 30 secs apart. I have run this strategy in MetaTrader no problem, so I thought I would be able to do it with NinjaTrader as well. Billitin, could you explain in more detail how this works? How do I get a global C# class to manage the orders?

        Comment


          #5
          You'll need to create a class in namespace NinjaTrader.Strategy (use any strategy template file for that) and initialize it only once per all run strategies, so that you can pass all your orders through it to modify them as needed and when necessary. From my experience it's not such an easy coding task for a beginner or someone who wants to learn the language... In the ideal world I'd rather find a way to execute my trades differently as I'm currently climbing the same wall
          Last edited by billitin; 07-11-2008, 11:38 PM.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by rajendrasubedi2023, Today, 09:50 AM
          3 responses
          15 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by lorem, Today, 09:18 AM
          2 responses
          11 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by geddyisodin, Today, 05:20 AM
          4 responses
          29 views
          0 likes
          Last Post geddyisodin  
          Started by geotrades1, Today, 10:02 AM
          2 responses
          10 views
          0 likes
          Last Post NinjaTrader_BrandonH  
          Started by ender_wiggum, Today, 09:50 AM
          1 response
          5 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Working...
          X