Ninjatrader novice

Discussion in 'Automated Trading' started by Jym, Aug 31, 2009.

  1. Jym


    Last night was the 1st time I've really messed around with any Strategy trading and the main problem I'm running into is getting the stoploss and profit target to work on Ninjatrader.

    Have any of you guys programmed much on there?

    I attached a file of the simulated return for the previous 2 week.
    This is the bullish part of a 2 part system i want to put together and it's looking alright so far if i could ever figure out how to exit sometime before the close.

    Here's the major part of the code.

    even switching the "true"/"false" setup didn't help out any. It just held a single contract thruout the entire simulation

    /// <summary>
    /// This method is used to configure the strategy and is called once before any strategy method is called.
    /// </summary>
    protected override void Initialize()
    SetProfitTarget("", CalculationMode.Percent, 0.1);
    SetStopLoss("", CalculationMode.Percent, 0.25, false);

    CalculateOnBarClose = true;

    /// <summary>
    /// Called on each bar update event (incoming tick)
    /// </summary>
    protected override void OnBarUpdate()
    // Condition set 1
    if (CrossAbove(GetCurrentAsk() + 2 * TickSize, Bollinger(2, 14).Lower, 2))
    EnterLong(DefaultQuantity, "");

    alright thanks
  2. From the manual

    CalculationMode.Percent (0.01 = 1%)
  3. Jym


    oh crap ok that's working

    i kind of slightly skimmed the help section but i guess i missed that part

  4. Jym


    And just like with programming what seems easy never is.

    I basically got the buy part to work in about 20 minutes last night but I've been working on the short sell portion all day off and on and it just isn't agreeing with me.

    I'm not really sure why it won't work.
    I entered a command for it to buy when it entered back into the lower bollinger band and it worked but if i enter a similar order to sell when a bar closes back inside the top band it only works half the time

    I was also hoping to be able to form a strategy off a custom made indicator but either it's just not reading the data properly, you have to do custom strategy programming for custom indicators, or I'm an idiot and it'd work if i changed one thing around.
  5. Jym


    Ok i finally got that bad boy to work.

    I basically stayed up all night last night working on it and spent a good bit of today off and on it

    Not exactly what i had in mind but it works pretty well in tests up to 2 weeks back then the Bollinger Bands become warped so it's hard to test the validity of it.

    It's designed to average down 3 times then a stoploss is triggered.
    I'd hate to do too much else to it if it'll actually keep performing like that especially on the YM, which is my fav, but i probably need to add some trailing stops and whatnot next.
  6. auspiv


  7. Jym


    Ok thanks
    looked around and found a couple really cool indicator codes while i was over there.

    I messed around and got some stops and profit targets in place for the 1 min chart to do some quicker intraday trading. The stop now seems to maximize profits but I'll probably end up doing something tighter and safer if I decide to run in live at some point.

    I was mainly trying to calibrate it for the YM but no matter what i do the TF seems to just eat it up so i may just have to switch to that haha

    a simulation on it for today between 11 am and 3 pm gave a $3660 net profit on 29 trades but it was with a gross loss of 2160 which could use some work.
    That was with a 3 contracts per entry with up to 3 entries in each direction setup.

    What kind of a gross loss to net profit ratio do you guys look for in a system before you'd actually use it on a day to day basis?
  8. Jym


    ok after adding more and more stuff I finally figured out that simple may just be least considering the past 2 months where we were basically moving straight up.
    On the demo my data only goes back to July.
    I wish we could have an at least halfway decent pullback to see how the strategy took it. The small one we had at the end of July, i think it was, actually worked out though. Choppy days with little movement seem to be the worse performing.
    I wish there was someway to catch downward movement as efficiently as upward movement but I haven't been able to figure it out yet.

    So yeah not a lot of trades only 30 in 2 months for the ES and YM each.

    So trading between 8:30 and 3:00

    2 month for ES with 1 contract a trade:
    max down day -$600

    2 month for YM with 1 contract
    max down day - $375