Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to enable autotrailing in condition builder for automated trading

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

  • NinjaTrader_Bertrand
    replied
    For an indicator you would need to code this directly in the NinjaScript editor. You can though use the Strategy Wizard to 'view' the code it would generate and copy then sections over to your new indicator.

    Leave a comment:


  • mate41
    replied
    Sorry Bertrand,
    moved my question to the right forum section. (indicator)
    Is not a strategy question.

    Leave a comment:


  • NinjaTrader_Bertrand
    replied
    You would set this up in the Strategy Builder's Condition Builder - http://www.ninjatrader.com/support/h...on_builder.htm

    For creating cross over conditions, please check into the 7th section from the above link from our helpguide ('How to create a cross over condition').

    Leave a comment:


  • mate41
    replied
    Hello Matthew,
    i've a question about macd conditions:
    condition1: macd crossing above slow ema (12)
    condition2: macd crossing below fast ema (26)
    How can i set these conditions ?

    Leave a comment:


  • NinjaTrader_Matthew
    replied
    Looks good davedxb,

    Let us know if you see any issues or have any questions.

    Leave a comment:


  • davedxb
    replied
    Originally posted by NinjaTrader_Bertrand View Post
    Dave, that would be simply a command to enter a long position - it would not provide any stop loss or trailing on the position. For calling an ATM template with the AutoTrail setup as needed, please use the AtmStrategyCreate(): http://www.ninjatrader.com/support/h...strategycreate
    Thanks for the quick response!

    So i created my Auto Trail strategy from the super DOM, just like shown over here:


    And i named my Auto Trail Strategy "myautotrailstats"

    Then, i go back to my code and it should look like this, where if triggered, the code shall call out the strategy i made "myautotrailstats"

    // Condition set 1
    if (CrossAbove(MACD(12, 26, 9), MACD(12, 26, 9).Avg, 1)
    {
    AtmStrategyCreate(OrderAction.Buy, OrderType.Market, 0, 0,
    TimeInForce.Day, GetAtmStrategyUniqueId(), "myautotrailstats",
    GetAtmStrategyUniqueId());
    }

    That didnt seem too hard!!!! taking into account i have not tested it yet! =] Does the above seem correct? Ill try it out on my demo account

    Leave a comment:


  • NinjaTrader_Bertrand
    replied
    Dave, that would be simply a command to enter a long position - it would not provide any stop loss or trailing on the position. For calling an ATM template with the AutoTrail setup as needed, please use the AtmStrategyCreate(): http://www.ninjatrader.com/support/h...strategycreate

    Leave a comment:


  • davedxb
    replied
    Ok...so after alot of practice and reading...my coding skills are much better.

    But i STILL cant get this auto trail to work.

    // Condition set 1
    if (CrossAbove(MACD(12, 26, 9), MACD(12, 26, 9).Avg, 1)
    {
    EnterLong(DefaultQuantity, ");
    }

    What i want is, when it enters long....to follow the market price, auto trail it by 5 ticks.
    So as the market price increase on every bar update....the auto trail will update and keep a distance of 5 ticks from the current market price. This way, if the price goes back down, more than 5 ticks on the next bar, the strategy will exit my long position.

    Any help would be great....

    Leave a comment:


  • davedxb
    replied
    Originally posted by NinjaTrader_Bertrand View Post
    Hi Dave, yes if you'd like to call AtmStrategyTemplate in your NinjaScript strategy then you'd need to work directly with the programming code in the NinjaScript editor, a full example is preinstalled with NT under the 'SampleAtmStrategy'.

    http://www.ninjatrader.com/support/h...gy_methods.htm

    Lovely link! i will go through all the codes and do some testing one by one....thank you...

    Leave a comment:


  • NinjaTrader_Bertrand
    replied
    Hi Dave, yes if you'd like to call AtmStrategyTemplate in your NinjaScript strategy then you'd need to work directly with the programming code in the NinjaScript editor, a full example is preinstalled with NT under the 'SampleAtmStrategy'.

    Leave a comment:


  • davedxb
    replied
    I want to implement this AutoTrail
    http://www.ninjatrader.com/support/helpGuides/HelpGuideV6/helpguide.html?AutoTrail

    Into Auto Trading Strategy....using Wizard..or code...if i have too...


    Maybe this is what i am looking for?
    Last edited by davedxb; 08-25-2011, 03:42 AM.

    Leave a comment:


  • NinjaTrader_Bertrand
    replied
    davedxb, welcome to our forums : on the stops & targets section please add for example the SetTrailStop to your strategy, you can then decide by how much ticks to trail.

    Leave a comment:


  • How to enable autotrailing in condition builder for automated trading

    So i have build my first simple SMA auto trading strategy.....works fine.

    But i would like to add a condition, auto trailing....so that when the strategy opens a position....to close it when the auto trailing conditions are met.

    example:

    I would like the autotrailing to trail the actual price and keep a distance of 5 units.
    So if the price reverses more than 5 units, the positions closes....

    Any tips or references to look at?

    I tried messing with the strategy builder wizard....still couldn't figure it out...
    http://www.ninjatrader.com/support/h...sitionStrategy
    Last edited by davedxb; 08-25-2011, 12:33 AM.

Latest Posts

Collapse

Topics Statistics Last Post
Started by Rxxar, Yesterday, 09:56 AM
5 responses
23 views
0 likes
Last Post NinjaTrader_Clayton  
Started by Orion815, Today, 07:36 AM
3 responses
13 views
0 likes
Last Post NinjaTrader_Jesse  
Started by -=Edge=-, 01-31-2018, 09:10 AM
17 responses
1,716 views
0 likes
Last Post tradeesh  
Started by WHICKED, 06-27-2023, 12:07 PM
89 responses
894 views
1 like
Last Post NinjaTrader_ChelseaB  
Started by ender_wiggum, 06-18-2024, 07:56 AM
9 responses
38 views
0 likes
Last Post NinjaTrader_Zachary  
Working...
X