Call ATM Strategy on an automated strategy to control position - NinjaTrader Programming | futures io social day trading
futures io futures trading


Notices

Call ATM Strategy on an automated strategy to control position
Updated: Views / Replies:3,134 / 7
Created: by jsengxx Attachments:0

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 100,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you dont need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

Call ATM Strategy on an automated strategy to control position

  #1 (permalink)
Membership Temporarily Revoked
POrtugal
 
Futures Experience: Advanced
Platform: Ninjatrader
 
Posts: 54 since Nov 2009
Thanks: 0 given, 21 received

Call ATM Strategy on an automated strategy to control position

Hello,

How can I call an ATM Strategy on an automated ninjascript strategy to control my position?

I have a strategy (VervoortMACrossover) that is working realy good but I want to control my position so I can go breakeven + trailstop.

I have no idea how to doo that.

Can some one help me?

Best regards,
JJ

Reply With Quote
 
  #2 (permalink)
Elite Member
Florida
 
Futures Experience: Intermediate
Platform: NT7
Favorite Futures: CL, NQ, NG
 
Posts: 469 since Jun 2009
Thanks: 1,393 given, 397 received

try the built-in SampleAtmStrategy

Reply With Quote
 
  #3 (permalink)
Elite Member
Dublin, Ireland.
 
Futures Experience: Advanced
Platform: NinjaTrader, TOS, Multicharts, Open Source various
Favorite Futures: FDAX, cable/yen, FX, options on commodities
 
mrticks's Avatar
 
Posts: 67 since Jun 2009
Thanks: 16 given, 9 received



jsengxx View Post
Hello,

How can I call an ATM Strategy on an automated ninjascript strategy to control my position?

I have a strategy (VervoortMACrossover) that is working realy good but I want to control my position so I can go breakeven + trailstop.

I have no idea how to doo that.

Can some one help me?

Best regards,
JJ

I submitted a template for this on the NT forums a while back. The link for the page is Links and Downloads Manager - NinjaTrader Support Forum and it's the one called "SampleATMCancelStrategy" near the bottom of the page.

Hope it helps!

Reply With Quote
The following 2 users say Thank You to mrticks for this post:
 
  #4 (permalink)
Elite Member
Milan (I)
 
Futures Experience: Advanced
Platform: Ninjatrader
Broker/Data: Kinetick
Favorite Futures: FDAX,6E,CL,YM,NQ,ES
 
redratsal's Avatar
 
Posts: 1,653 since Oct 2010
Thanks: 1,217 given, 2,076 received


jsengxx View Post
Hello,

How can I call an ATM Strategy on an automated ninjascript strategy to control my position?

I have a strategy (VervoortMACrossover) that is working realy good but I want to control my position so I can go breakeven + trailstop.

I have no idea how to doo that.

Can some one help me?

Best regards,
JJ

Try this

In Variables

privateint trailstop = 10;



protectedoverridevoid OnBarUpdate()

if (Position.MarketPosition == MarketPosition.Long)
{
// Once the price is greater than entry price+ ticks, set stop loss to breakeven
if (Close[0] > Position.AvgPrice - trailstop * TickSize)
{
SetStopLoss(CalculationMode.Price, Position.AvgPrice - trailstop * TickSize);
}
}



In region properties

[Description("")]
[GridCategory(
"Parameters")]
publicint TrailStop
{
get { return trailstop; }
set { trailstop = Math.Max(1, value); }
}


adjust your trailstop accordingly for breakeven set it to 0

Reply With Quote
The following 2 users say Thank You to redratsal for this post:
 
  #5 (permalink)
Elite Member
Prague/Czech Republic
 
Futures Experience: Intermediate
Platform: Ninjatrader
Favorite Futures: YM, RTY
 
Posts: 13 since Sep 2011
Thanks: 2 given, 0 received


mrticks View Post
I submitted a template for this on the NT forums a while back. The link for the page is Links and Downloads Manager - NinjaTrader Support Forum and it's the one called "SampleATMCancelStrategy" near the bottom of the page.

Hope it helps!

Hello Mrticks,

I found your sample template on ninjatrader support forum and I would like to use it since I am not able to program some decent trailing stop loss strategy via strategy wizard.

I have three questions:
1. can I change name of the ATM templates - where in your code I need to change it?
2. how I can merge my conditions with your strategy - should I just copy and paste into on bar update session?
3. is it backtesteble. I read in ninja help that ATM strategy is not backtesteble?

Thank you very much for your feedback in advance.

Miroslav

Reply With Quote
 
  #6 (permalink)
Elite Member
Dublin, Ireland.
 
Futures Experience: Advanced
Platform: NinjaTrader, TOS, Multicharts, Open Source various
Favorite Futures: FDAX, cable/yen, FX, options on commodities
 
mrticks's Avatar
 
Posts: 67 since Jun 2009
Thanks: 16 given, 9 received


harcesis View Post
Hello Mrticks,

I found your sample template on ninjatrader support forum and I would like to use it since I am not able to program some decent trailing stop loss strategy via strategy wizard.

I have three questions:
1. can I change name of the ATM templates - where in your code I need to change it?
2. how I can merge my conditions with your strategy - should I just copy and paste into on bar update session?
3. is it backtesteble. I read in ninja help that ATM strategy is not backtesteble?

Thank you very much for your feedback in advance.

Miroslav

Hello Miroslav,

I have not used NT in over 5 years but I will try to help!

1. Look for this section in the code, this is where you need to edit your ATM template names to match what you have created locally.
 
Code
           // Submits an entry limit order at the current low price to initiate an ATM Strategy if both order id and strategy id are in a reset state
            // **** YOU MUST HAVE AN ATM STRATEGY TEMPLATE NAMED 'TF_long_3W_3BR' and 'TF_short_3W_3BR' CREATED IN NINJATRADER (SUPERDOM FOR EXAMPLE) FOR THIS TO WORK  you can create your own****
                        if (orderIdL.Length == 0  
                                && atmStrategyIdL.Length == 0
								&& FirstTickOfBar
                                && Close [1] <= Open [1]
							    && High  [1] + PrevBarsPlusTicks * TickSize > GetCurrentBid())
                               
                        {
                                atmStrategyIdL = GetAtmStrategyUniqueId();
                                orderIdL = GetAtmStrategyUniqueId();
                                orderBarL = CurrentBar;
                                AtmStrategyCreate(Cbi.OrderAction.Buy, OrderType.Stop, 0, High[1] + PrevBarsPlusTicks * TickSize, TimeInForce.Day, orderIdL, "TF_long_3W_3BR", atmStrategyIdL);	
			    
						}
                        if (orderIdS.Length == 0  
                                && atmStrategyIdS.Length == 0  
                                && FirstTickOfBar
                				&& Close [1] >= Open [1]
                				&& Low   [1] - PrevBarsMinusTicks * TickSize < GetCurrentAsk())
                               
                        {
                                atmStrategyIdS = GetAtmStrategyUniqueId();
                                orderIdS = GetAtmStrategyUniqueId();
                                orderBarS = CurrentBar;
                                AtmStrategyCreate(Cbi.OrderAction.Sell, OrderType.Stop, 0, Low[1] - prevBarsMinusTicks * TickSize, TimeInForce.Day, orderIdS, "TF_short_3W_3BR", atmStrategyIdS);

2. Yes, look for this section and insert your code in their:
 
Code
  /// <summary>
        /// Called on each bar update event (incoming tick)
        /// </summary>
        protected override void OnBarUpdate()
3. I could never get NT to backtest with an ATM being called via a strategy!


Have fun!

Reply With Quote
 
  #7 (permalink)
Elite Member
Prague/Czech Republic
 
Futures Experience: Intermediate
Platform: Ninjatrader
Favorite Futures: YM, RTY
 
Posts: 13 since Sep 2011
Thanks: 2 given, 0 received


mrticks View Post
Hello Miroslav,

I have not used NT in over 5 years but I will try to help!

1. Look for this section in the code, this is where you need to edit your ATM template names to match what you have created locally.
 
Code
           // Submits an entry limit order at the current low price to initiate an ATM Strategy if both order id and strategy id are in a reset state
            // **** YOU MUST HAVE AN ATM STRATEGY TEMPLATE NAMED 'TF_long_3W_3BR' and 'TF_short_3W_3BR' CREATED IN NINJATRADER (SUPERDOM FOR EXAMPLE) FOR THIS TO WORK  you can create your own****
                        if (orderIdL.Length == 0  
                                && atmStrategyIdL.Length == 0
								&& FirstTickOfBar
                                && Close [1] <= Open [1]
							    && High  [1] + PrevBarsPlusTicks * TickSize > GetCurrentBid())
                               
                        {
                                atmStrategyIdL = GetAtmStrategyUniqueId();
                                orderIdL = GetAtmStrategyUniqueId();
                                orderBarL = CurrentBar;
                                AtmStrategyCreate(Cbi.OrderAction.Buy, OrderType.Stop, 0, High[1] + PrevBarsPlusTicks * TickSize, TimeInForce.Day, orderIdL, "TF_long_3W_3BR", atmStrategyIdL);	
			    
						}
                        if (orderIdS.Length == 0  
                                && atmStrategyIdS.Length == 0  
                                && FirstTickOfBar
                				&& Close [1] >= Open [1]
                				&& Low   [1] - PrevBarsMinusTicks * TickSize < GetCurrentAsk())
                               
                        {
                                atmStrategyIdS = GetAtmStrategyUniqueId();
                                orderIdS = GetAtmStrategyUniqueId();
                                orderBarS = CurrentBar;
                                AtmStrategyCreate(Cbi.OrderAction.Sell, OrderType.Stop, 0, Low[1] - prevBarsMinusTicks * TickSize, TimeInForce.Day, orderIdS, "TF_short_3W_3BR", atmStrategyIdS);

2. Yes, look for this section and insert your code in their:
 
Code
  /// <summary>
        /// Called on each bar update event (incoming tick)
        /// </summary>
        protected override void OnBarUpdate()
3. I could never get NT to backtest with an ATM being called via a strategy!


Have fun!

Hello Mrticks,

thank you for your replay. Sorry for delay I am trying to fix overfill issues until I will proceed with adding ATM strategy.

I am using unirenko charts and it seems it is opening extra positions in high volatility times.

I am trying to use bool logic to prevent extra entry if trade was once triggered.

Can I come back to you when I fix my overfill issue?

Thank you

Miroslav

Reply With Quote
 
  #8 (permalink)
Elite Member
Dublin, Ireland.
 
Futures Experience: Advanced
Platform: NinjaTrader, TOS, Multicharts, Open Source various
Favorite Futures: FDAX, cable/yen, FX, options on commodities
 
mrticks's Avatar
 
Posts: 67 since Jun 2009
Thanks: 16 given, 9 received


harcesis View Post
Hello Mrticks,

thank you for your replay. Sorry for delay I am trying to fix overfill issues until I will proceed with adding ATM strategy.

I am using unirenko charts and it seems it is opening extra positions in high volatility times.

I am trying to use bool logic to prevent extra entry if trade was once triggered.

Can I come back to you when I fix my overfill issue?

Thank you

Miroslav

Best of luck with the overfill issue!

Reply With Quote

Reply



futures io > > > > > Call ATM Strategy on an automated strategy to control position




Upcoming Webinars and Events (4:30PM ET unless noted)
 

Fundraiser: Feeding Families in Need (ends Dec 17)

December
 

Battlestations! Show us your trading desks w/GFF Brokers ($750 in Prizes)

January
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
ATM Strategy Assistance TraderJoe0410 NinjaTrader 12 August 22nd, 2011 04:05 PM
Ninjatrader7 ATM Strategy combine with Strategy Wizard Ninja Script schuster21 NinjaTrader Programming 4 July 4th, 2011 05:39 PM
ATM Strategy won't appear in the strategy window on N7 PiCoTrader Traders Hideout 6 December 15th, 2010 03:41 AM
ATM Strategy for Ninjatrader keepdchange NinjaTrader 6 October 6th, 2010 04:57 AM
ATM Strategy Errors zeller4 NinjaTrader Programming 7 August 22nd, 2010 11:24 AM


Tags
atm, atm strategy, automated strategy, backtest, backtesting, bar update, code, dow, feedback, how to, limit order, marketposition, market_replay, ninjascript, ninjatrader, replay, setstoploss, stop loss, stoploss, strategy, strategy wizard, superdom, templates, tf, trailing stop, trailing stop loss, unirenko, update, volatility

All times are GMT -4. The time now is 06:43 PM. (this page content is cached, log in for real-time version)

Copyright © 2018 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432 WhatsApp Business, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts
Page generated 2018-12-14 in 0.17 seconds with 14 queries on phoenix