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

some help with ninjascript trade management please.

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

    some help with ninjascript trade management please.

    Ok, I am digging into ninja script for making a strategy, I have done a small amount of c# scripting for game development a few years back, and have got my script where it picks out the signals I want to trade, but I'm having heck figuring out how to make it work, I spent a while in a video tute with no luck before I found out that it was old and IOrder was no longer used. then I found my way here. https://ninjatrader.com/support/help...and_onexec.htm but when I try and set the order variable as shown "private Order entryOrder = null;" I get the error Severity Code Description Project File Line Suppression State
    "Error CS0104 'Order' is an ambiguous reference between 'NinjaTrader.Cbi.Order' and 'NinjaTrader.CQG.ProtoBuf.Order' NinjaTrader.Custom "

    I have included an image to help explain what behavior I am looking for. for this example I will use the second set of signals, you can see I have a set of diamonds, red: stop, green: entry, silver: first target, gold: second target (tho I believe I will change this to be a runner,)

    so here's what I need
    A signal is placed: enter 2 stoplimit orders at the green diamond with no expiration (i believe that's the kind I want I'm still a bit confused about the different entries). if the price rises to hit the green diamond price before falling to the red diamond price, the order is filled and 2 long positions are entered, if it falls to the stop loss first, the orders are canceled and the strat resets and looks for a new entry.

    if the positions are filled when the price gets to the silver target, one of the orders should be filled, and the stop loss should move to 1pt above breakeven, if the price moves up to the gold target, the top moves to the silver target, and so on and on moving the price up in those increments until it it gets stopped out.

    I also am looking later to implement a setting to allow it to stack orders from multiple entries, but I am not worried about that in this iteration.

    I am not looking for someone to do this for me, but just some tips about how to go about this, or what resources I could look at. Thanks


    #2
    Hello CoffeeOutlaw,

    For the error you are getting you likely have a problem with the using statements at the top of the file. The most simple way to correct this is to generate a new empty strategy and then copy all of the using statements from that script over the using statements in your current script.

    If you need to learn more about the order types you can use a public trading resource like investopedia to learn about types (Limit, stop market, market, etc). The NinjaScript api/platform will follow the standard market terms for order types so that information would be relevant here. You can also place trades manually in the chart trader to learn how they can be used.

    For the other parts you would need to break this down to the individual parts you want to accomplish. We can go over each that you are not clear about, for example drawing or building conditions. The existing scripts in the NinjaScript editor are a good learning resource if you need to know about the standard NinjaScript code that can be used. You can also download third party items from the public user app share to explore other concepts.


    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by judysamnt7, 03-13-2023, 09:11 AM
    4 responses
    57 views
    0 likes
    Last Post DynamicTest  
    Started by ScottWalsh, Today, 06:52 PM
    4 responses
    36 views
    0 likes
    Last Post ScottWalsh  
    Started by olisav57, Today, 07:39 PM
    0 responses
    7 views
    0 likes
    Last Post olisav57  
    Started by trilliantrader, Today, 03:01 PM
    2 responses
    20 views
    0 likes
    Last Post helpwanted  
    Started by cre8able, Today, 07:24 PM
    0 responses
    9 views
    0 likes
    Last Post cre8able  
    Working...
    X