NexusFi: Find Your Edge


Home Menu

 





Sample Advanced Automated Strategy v1.0


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one dsraider with 36 posts (41 thanks)
    2. looks_two wgreenie with 21 posts (1 thanks)
    3. looks_3 gg80108 with 11 posts (6 thanks)
    4. looks_4 Ducman with 7 posts (0 thanks)
      Best Posters
    1. looks_one MXASJ with 3 thanks per post
    2. looks_two dsraider with 1.1 thanks per post
    3. looks_3 cbritton with 0.7 thanks per post
    4. looks_4 gg80108 with 0.5 thanks per post
    1. trending_up 49,685 views
    2. thumb_up 64 thanks given
    3. group 27 followers
    1. forum 117 posts
    2. attach_file 15 attachments




 
Search this Thread

Sample Advanced Automated Strategy v1.0

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

Hey Beth,

The code I sent for your BE and trail will do the following:

Set initial SL at -15 ticks.
Move SL to breakeven when you are +8 ticks in profit.
Move SL up two ticks when you are +10 ticks in profit and every two from then on.

You changed my original code a little but I have it move to breakeven when price = +8 and then kick in the trail when price is > 9 (which translates to 10). Subtle changes can make all the difference.

As far as your exit is concerned, if you now have it set to current bar, it should exit the instant you get a cross. If you want to make sure it closes as a cross, go back to [1]. This exit is a bit of a guess, as I don't use one and so am not certain of how it responds to FirstTickOfBar, but it's a good guess.

Let me know if I have your trail strategy right and how this works out. Again, the trail will work in simulation mode in case you don't want to wait for actual market conditions to test.

Good luck,
Dave

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Better Renko Gaps
The Elite Circle
REcommedations for programming help
Sierra Chart
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
How to apply profiles
Traders Hideout
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
29 thanks
Just another trading journal: PA, Wyckoff & Trends
25 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
23 thanks
GFIs1 1 DAX trade per day journal
18 thanks
  #32 (permalink)
 wgreenie 
Cambridge, Ontario
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Zen-Fire
Trading: 6E
Posts: 1,778 since Dec 2009
Thanks Given: 1,258
Thanks Received: 1,203

Hi Dave

Thanks for your best wishes. The strategy worked funny starting 3:28, ie in-and-out within a second (per enclosed trade log). I also notice the following:

1. Trade No 4 Long @557: It went up to 582 and there's a BE SL trade @557 (cancelled status) before its closing @572. If the trail code was working, should there be some trail stop orders listed on the Orders tab?

2. Starting Trade No 6, it triggered in-and-out trades until 3:43 (you will see the trade markers on the enclosed chart).

I have absolutely no idea what I did wrong when adding the trail code. Sorry! Enclosed is my strategy with the trail code + the required indicators in case you want to run it (the strategy is supposed to work best on a 4-tick MedianRenko chart).

My super-mega Thank You for checking it for me please! Thank You .. Thank You!

Beth

Attached Thumbnails
Click image for larger version

Name:	YM 03-10  3_10_2010 (MedianRenko 4 Ticks).jpg
Views:	403
Size:	166.7 KB
ID:	9503   Click image for larger version

Name:	YM Trade Log w Trail.JPG
Views:	315
Size:	111.9 KB
ID:	9505  
Attached Files
Elite Membership required to download: TheWizardv5ibRevised3timewTrail.zip
Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #33 (permalink)
dsraider
New York, NY
 
Posts: 142 since Dec 2009
Thanks Given: 41
Thanks Received: 87


Good news/Bad news....

The good news is I fixed your trail. Please make the following changes to your code:

SetStopLoss("Long ", CalculationMode.Ticks, 15, false); should be
SetStopLoss("", CalculationMode.Ticks, 15, false);

Also, in the trail part, (not the BE part) use:
SetStopLoss(longEntryID, CalculationMode.Price, newPrice, false); and
SetStopLoss(shortEntryID, CalculationMode.Price, newPrice, false);

The other problems you're having seem to be coming from your exit code. I ran into the same problems you did, until I commented that part out. The bad news, unfortunately, is that I don't know how to fix it. Maybe someone else more experienced with exits can give you a hand there. I'm sorry I couldn't be of more help. Let me know if you're able to solve it or if any other issues come up. And again, good luck.

Dave

Reply With Quote
Thanked by:
  #34 (permalink)
 wgreenie 
Cambridge, Ontario
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Zen-Fire
Trading: 6E
Posts: 1,778 since Dec 2009
Thanks Given: 1,258
Thanks Received: 1,203

Thanks Dave for making the trail work. Time to celebrate!

I've made the suggested changes and will sim trade it tomorrow. Will try both false and true for CalculateOnBarClose unless you advise that true will not work for trail. Funny that the same Exit conditions (for those without trail) have been working over a week and no looping trades.

A member opines that

"Crazy multiple trades sometimes happens when set at CalculateOnBarClose = false. I think the strat gets overwhelmed."

Let's see what may happen tomorrow before my further investigation on the Exit conditions. My heartfelt thanks again Dave!

Beth

Visit my NexusFi Trade Journal Reply With Quote
  #35 (permalink)
dsraider
New York, NY
 
Posts: 142 since Dec 2009
Thanks Given: 41
Thanks Received: 87

That is strange. Maybe if I were more experienced I'd be able to do more, but I'm really just a very, very stubborn newbie. I think setting it to true will not give you the results you want but I guess it doesn't hurt to try. Keep me posted. I hope you figure out the rest.

Dave

Reply With Quote
  #36 (permalink)
 wgreenie 
Cambridge, Ontario
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Zen-Fire
Trading: 6E
Posts: 1,778 since Dec 2009
Thanks Given: 1,258
Thanks Received: 1,203

Thanks Dave for your kind encouragement and best wishes. Hey, I'm lucky to have YOU fixing my trail code!

I will fix the [0] now to have CalculateOnBarClose: true version running as well. Will share the results with you.

Enjoy a Nice evening/Great Thu.

Beth (grateful)

Visit my NexusFi Trade Journal Reply With Quote
  #37 (permalink)
dsraider
New York, NY
 
Posts: 142 since Dec 2009
Thanks Given: 41
Thanks Received: 87

Beth,

Do me a favor. Can you add FirstTickOfBar to your exit and set the condition back one bar like we did with the entry? It just occurred to me to try this. I should have thought of it earlier.

Dave

Reply With Quote
  #38 (permalink)
 wgreenie 
Cambridge, Ontario
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Zen-Fire
Trading: 6E
Posts: 1,778 since Dec 2009
Thanks Given: 1,258
Thanks Received: 1,203

Thanks Dave. I did set the exit conditions back one bar like we did with the entry. Just added "FirstTickOfBar" per your kind suggestion.

Close[0]<Low[1] and Close[0]>High[1] is one of the exit conditions for Long and Short respectively. I just noticed this version is more profitable than Close[1]<Low[2] and Close[1]>High[2] when I backtested the strategy. (Oh, it's an inadvertent error when I fixed the "back one bar" earlier.)

I wonder if I should keep this as-is or try both versions live tomorrow. What do you think?

Beth

Visit my NexusFi Trade Journal Reply With Quote
  #39 (permalink)
dsraider
New York, NY
 
Posts: 142 since Dec 2009
Thanks Given: 41
Thanks Received: 87

I think you should go long 10 cars at open with no stops or targets and run screaming from your home! Okay, okay, I'm just kidding.

I see harm in trying both. I've read too many bad things about the inaccuracies of backtesting, so I'm all about testing live. Either way, I'll be happy if the strat works how it's supposed to.

Let me know,
D

Reply With Quote
  #40 (permalink)
 wgreenie 
Cambridge, Ontario
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Zen-Fire
Trading: 6E
Posts: 1,778 since Dec 2009
Thanks Given: 1,258
Thanks Received: 1,203


You're right on Dave! We canNOT trust backtest results especially MedianRenko ones. I learned this after backtesting my draft strategies and got really really excited LOL! Yes, only sim results (or maybe Market Replay ones) are more reliable.

Wish me luck tomorrow!

Night-night.

Beth

Visit my NexusFi Trade Journal Reply With Quote




Last Updated on November 16, 2011


© 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