NexusFi: Find Your Edge


Home Menu

 





ATM Template?


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one dsraider with 6 posts (4 thanks)
    2. looks_two max-td with 4 posts (1 thanks)
    3. looks_3 jmejedi with 1 posts (0 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 6,304 views
    2. thumb_up 5 thanks given
    3. group 2 followers
    1. forum 12 posts
    2. attach_file 1 attachments




 
Search this Thread

ATM Template?

  #1 (permalink)
dsraider
New York, NY
 
Posts: 142 since Dec 2009
Thanks Given: 41
Thanks Received: 87

Hey All,

I'm in the process of writing a fully automated strategy that will do the following:

1. enter limit orders (long/short) for two cars (ES) when my signal criteria is met
2. will cancel the limit orders automatically should price gap 4 ticks away before filling
3. if filled, will set initial stops and two different targets (for scaling out)
4. moves both stops to breakeven at +4 ticks in profit (my first target - using B/E because my targets never sell at first touch)
5. moves stop up on 2nd car (after first is filled) tick by tick, like a trail
6. only trades from 10:15 AM to 3:15 PM (EST)
7. will only enter one trade at a time, even though strat is working on several timeframes
8. will shut down if daily loss is X dollars
9. will email me details (direction, entry price, target/stop fills & prices)

I've already coded and tested most of this but when I went to change market orders to limit, it simply stopped working. I'm sure I'm not the only one who wants to do this so I was wondering if anyone knew of a sort of glorified ATM strat template that has all or most of this laid out, so people can simply enter their own parameters. I've practically tattooed ninja's forum to my brain and have installed more sample strats than I can count. They've helped tremendously but I find them to be incomplete.

Anyway, thanks for reading through both hours of my post
Dave

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
MC PL editor upgrade
MultiCharts
Exit Strategy
NinjaTrader
Increase in trading performance by 75%
The Elite Circle
Trade idea based off three indicators.
Traders Hideout
REcommedations for programming help
Sierra Chart
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
34 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
19 thanks
GFIs1 1 DAX trade per day journal
16 thanks
Vinny E-Mini & Algobox Review TRADE ROOM
13 thanks
  #3 (permalink)
 
max-td's Avatar
 max-td 
Frankfurt
 
Experience: Intermediate
Platform: NinjaTrader
Trading: FGBL 6E B4
Posts: 1,752 since Jun 2009
Thanks Given: 2,309
Thanks Received: 927


hi dsraider ,

first step would be : post what you have coded + tried yet !
so we do not run into the same issues / direction you had yet.

max-td
Reply With Quote
  #4 (permalink)
dsraider
New York, NY
 
Posts: 142 since Dec 2009
Thanks Given: 41
Thanks Received: 87

Sir, I cannot argue with you when you use logic against me! Apologies, but my brain is currently fried.

As you can see in the code, I will be adding the 20k and 30k charts to be covered by this strat using BarsInProgress (initial chart will be the 10k). I only have the Add() lines in right now. This is just to make sure it works on one first. You will need BigMike's DoubleMA in order to run. I'll add to my signal later but this will do for now. It usually works fine but sometimes the order self-cancels upon entry, saying I've set my stop as much as nine points in the opposite direction. Be on the lookout and good luck. Any help you can give, especially with respect to the placing of limit orders and the CancelOrder() criteria I described would be of great help.

Thanks,
Dave

UPDATE: Fixed a bug - SetStopLoss for shorts were both set to "Short 1a". Changed the second to 1b and it now works as it should. Currently working on changing these from market to limit orders. Will report back. NOTE: You will have to change "a" to "b" on your own right now as I am currently in a state of uncompiled madness...

Attached Files
Elite Membership required to download: DoubleMAStrat.zip
Reply With Quote
Thanked by:
  #5 (permalink)
 
max-td's Avatar
 max-td 
Frankfurt
 
Experience: Intermediate
Platform: NinjaTrader
Trading: FGBL 6E B4
Posts: 1,752 since Jun 2009
Thanks Given: 2,309
Thanks Received: 927

hey you,
glad to hear you found the error!
i had a short look into the strat but wasnt able to go through with enaugh concentration/time the last days.

changing STOPS from market to limit orders - i think thats a tricky thing.
its high riks depending on the market you trade -- if it runs through without a fill you get in BIG troubles ! i would not recomment this!
if you wanna go out - go OUT - and dont risk to get no fill!

and i also believe that its not possible at every exchange - it isnt accepted from all exchanges. but i dont have exact infos about this.
maybe someone else can comment this.

max-td
Reply With Quote
  #6 (permalink)
dsraider
New York, NY
 
Posts: 142 since Dec 2009
Thanks Given: 41
Thanks Received: 87

Oh, I hear you loud and clear. That's why I'm currently trying to get CancelOrder() to kick in after X number of ticks, should my limit order not fill. I suggested to one of the ninjatrader forum guys (to whom I will soon owe my life) that they create an advanced wizard to deal with things like this. In the meantime, once I get this thing complete (still have a few things to add) I'll post it here as a template so people can just grab it and plug in their signals/parameters.

One thing, though. I'm not changing my stops to limit orders (I'm crazy but I'm not that crazy). I'm changing the entry market orders to limit orders (hence the CancelOrder() language). For the stops, I'm setting an initial stop, then turning it into a trailing stop. That part actually works. I'm not really sure how but I just keep drinking until everything complies

Reply With Quote
  #7 (permalink)
 
max-td's Avatar
 max-td 
Frankfurt
 
Experience: Intermediate
Platform: NinjaTrader
Trading: FGBL 6E B4
Posts: 1,752 since Jun 2009
Thanks Given: 2,309
Thanks Received: 927


dsraider View Post
In the meantime, once I get this thing complete (still have a few things to add) I'll post it here as a template so people can just grab it and plug in their signals/parameters.

Great idea ! - Thats the way the place works here.


Let me think - once i created smoething like this "cancel if the price runs away without a fill"-stuff ....

i created a double on the Bars high / Low together with the signal-trigger-Bar and then i usesed the cancel-function if the price ran more then this double + X ticks .
but i had to wait for a Barclose to use the bar-high for messuring this.
its not easy to do this intrabar.

so if you where using very small timeframes - that may work for you.
if you use bigger timeframes and the target-vakue is reached long before you have a new barclose - its a probleme - we had a discusion about this somewhere these days.

One solution is to run a multitimeframe-strategy and implant a 1 Range-timeframe.
that gives you the possibility to grab a usable bar-High-value for your messuring-double every new tick higher so to say.

hehe - hope this it understandable - its still early morning here

cu later


max-td
Reply With Quote
Thanked by:
  #8 (permalink)
dsraider
New York, NY
 
Posts: 142 since Dec 2009
Thanks Given: 41
Thanks Received: 87

That would help explain my current battle with the intrabar CancelOrder() language. The weird thing is 'Close[0]' actually works perfectly for current price in the trail part so I'm about to test 'if(Close[0] >= Close[1] + X * TickSize)' where Close[1] is the close of the previous bar (my current entry price). Strange, but if it works, it works. The NT Forum guys said it will work. We shall soon see.

Great tip about the range. I NEVER would have thought of that so thanks for the tip.

It's 5:22 AM here so you're the one that needs luck understanding me

Dave

Reply With Quote
  #9 (permalink)
dsraider
New York, NY
 
Posts: 142 since Dec 2009
Thanks Given: 41
Thanks Received: 87

max-td,

In case you (or anyone else) were curious, if(Close[0] >= Close[1] + X * TickSize did NOT work. Nor did anything else I tried today. I hear you on the Range addition but I was hoping to avoid that. So, if you (or anyone else) knows how to cancel an unfilled limit order once it's X number of ticks away intrabar, I will clean your house! Once that's done, I can post this thing.

Later,
Dave

Reply With Quote
  #10 (permalink)
 
max-td's Avatar
 max-td 
Frankfurt
 
Experience: Intermediate
Platform: NinjaTrader
Trading: FGBL 6E B4
Posts: 1,752 since Jun 2009
Thanks Given: 2,309
Thanks Received: 927


well - i think that you have basicly to decide if you run your strat

- calc on bar close - true
OR
- - calc on bar close - false (every-tick--calc)

so you can NOT have both together like ENTRY-Trigger on Bar-close-conditions
and
cancel-trigger as intrabar-calculation.

Thats the point i think.

To our Strat-coders -> please correct me if there are other soutions ! Thanks

max-td
Reply With Quote




Last Updated on May 23, 2012


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts