NexusFi: Find Your Edge


Home Menu

 





Setting up a strategy: confused with all the methods


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one Trader.Jon with 7 posts (2 thanks)
    2. looks_two wown with 5 posts (0 thanks)
    3. looks_3 baruchs with 4 posts (1 thanks)
    4. looks_4 bnichols with 1 posts (0 thanks)
    1. trending_up 5,656 views
    2. thumb_up 3 thanks given
    3. group 4 followers
    1. forum 17 posts
    2. attach_file 0 attachments




 
Search this Thread

Setting up a strategy: confused with all the methods

  #1 (permalink)
wown
Boston
 
Posts: 21 since Nov 2010
Thanks Given: 0
Thanks Received: 17

Hi guys,

A little background:

I have spent the last few months coding and testing a couple of indicators created by Tom Demark (I would post a link but the forum wont let me please google it). Specifically, I have managed to code the Setup, Combo, and Sequential in ninjatrader.

Now, I want to automate the trading (or at least backtest it) so that I can trade a strategy based on these indicators. In short here is the strategy (works for either direction, long or short. I will explain the long side):
1. When any 2 of indicators (setup or combo or sequential) are completed within 5 bars of each other, a buy signal is ready.
2. Calculate targets 1, 2 and a stop loss. basically, take 33,50,61, 23) retracements for the two completed sub-signals.
compare the 33,50,and 61 retarcements between the two sub-signals and figure out which two retracements are the closest (see pictures below). the lower of the two smallest differences is target 1, while the higher is target 2. Stop loss is the 23% retracement average for the two sub-signals.
I have everything up to here coded.

3. So, I want to enter long when my buy signal is ready. i will enter long with target 1,2 and stop loss when the ask price is more than the close/open (whichever is higher) of the previous bar. i want to keep the order open for 5 bars then cancel the order and basically forget about this signal.
4. once i enter, i want to
a: sell 25% at target 1 and move stop loss to B/E
b: sell 50% at target 2, and move stop loss to target 1
c: if price moves beyond the high of any of the sub signals (already calculated), start a trailstop loss with some amount (for the sake of argument, lets say 10% of the range of the subsignal exceeded - can be easily caluclated).
d: and of course sell all if we go to stop loss.

As I said, I have already coded points 1 and 2. But I am highly confused by how to manage my orders in the way described above. Ideally, I want to be able to optimize and see what settings work best (for example sell 50% at target 1, etc). I would really appreciate it if I can get some guidance on how to code the above points 3 and 4. I would be happy to share the indicators with you if you are interested if you can help me code my strategy.

I have included some pictures on my blog (stockjockz.blogspot.com/2011/03/strategy-definition.html) to show what I intend to do.

Thanks a lot!

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
MC PL editor upgrade
MultiCharts
Better Renko Gaps
The Elite Circle
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
PowerLanguage & EasyLanguage. How to get the platfor …
EasyLanguage Programming
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
31 thanks
Spoo-nalysis ES e-mini futures S&P 500
28 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
20 thanks
GFIs1 1 DAX trade per day journal
17 thanks
  #3 (permalink)
 baruchs 
Israel
 
Experience: Intermediate
Platform: NinjaTrader
Broker: pfg
Trading: eminis
Posts: 323 since Jun 2009


Hi,
I just want to advise you to code any strategy with only one target.
In your case code 3 variants of your strategy. One for each PT. Then see if each is a profitable strategy. (My guess is that not), then you can combine them or just trade 3 strategies.

Baruch

Reply With Quote
  #4 (permalink)
 
bnichols's Avatar
 bnichols 
Dartmouth NS
 
Experience: Intermediate
Platform: MC, MC.Net, NT, TWS
Broker: IB / IQFeed / Kids
Trading: Forex, stocks
Posts: 637 since Feb 2010
Thanks Given: 64
Thanks Received: 460

I found Big Mike's Hurley9_5 and MWinfrey's GenericStrategy_v1 (available to Elite members) very instructive as templates for order management.

P.S. I don't intend to influence anyone one way or another about Elite membership but for me it's proven worthwhile.

Visit my NexusFi Trade Journal Reply With Quote
  #5 (permalink)
wown
Boston
 
Posts: 21 since Nov 2010
Thanks Given: 0
Thanks Received: 17


Quoting 
Hi,
I just want to advise you to code any strategy with only one target.
In your case code 3 variants of your strategy. One for each PT. Then see if each is a profitable strategy. (My guess is that not), then you can combine them or just trade 3 strategies.

Baruch

I am not sure how would you structure that. You will have 3 independant strategies, execute them all at the same time?? I am confused.
Also, when you say "my guess is that not", i assume you are referring to the strat? why do u say that?

thanks

Reply With Quote
  #6 (permalink)
 baruchs 
Israel
 
Experience: Intermediate
Platform: NinjaTrader
Broker: pfg
Trading: eminis
Posts: 323 since Jun 2009


Quoting 
I am not sure how would you structure that. You will have 3 independant strategies, execute them all at the same time?? I am confused.
Also, when you say "my guess is that not", i assume you are referring to the strat? why do u say that?

Let say that your strategy gives 4K a month. Its a good result, even very good. But now you examine each setup separately and you see that setup with a smallest target end with -2K, the setup with the second target ends with -1K. What is the result of a biggest target? What will you do? Continue the same? You need to know this!
So yes first test each target separately and if each is profitable you can combine them into one strategy or trade 3 strategies together.
Please, after you code your strategy that way and all 3 targets are profitable, post the results here and I'll eat my hat.

Baruch

Reply With Quote
  #7 (permalink)
 
Trader.Jon's Avatar
 Trader.Jon 
Near the BEuTiFULL Horse Shoe
 
Experience: Beginner
Platform: NinjaTrader
Broker: MBTrading Dukascopy ZenFire
Trading: $EURUSD when it is trending
Posts: 473 since Jul 2009
Thanks Given: 401
Thanks Received: 184


baruchs View Post
Let say that your strategy gives 4K a month. Its a good result, even very good. But now you examine each setup separately and you see that setup with a smallest target end with -2K, the setup with the second target ends with -1K. What is the result of a biggest target? What will you do? Continue the same? You need to know this!
So yes first test each target separately and if each is profitable you can combine them into one strategy or trade 3 strategies together.
Please, after you code your strategy that way and all 3 targets are profitable, post the results here and I'll eat my hat.

Baruch

Baruch,

I dont want to eat hat, but I am interested in your response to my perspective of market activity.

I have been backtesting and SIM a strategy with 3 targets: PT1 and PT 2 are hard coded targets and PT3 is a 'runner' with a maximum target. Runner is referencing that there is a trailing code setup, besides the hard code stoploss. PT 1 and PT2 are taken out by the stoploss, or traget hit, or an exit algorithm based on 3 indicators. This is not the final setup, just example of looking at the distribution of targets and backtested profit values.

Optimization based on two months data, and out of sample test without changeing parameters is 10 months.

Using EURUSD as an example, PT1 of 7 pips target x 10000 euro = 38% of profit acheived
and PT2 of 12pips target x 10000 euro = 35% of profit acheived
and PT3 of 40pips target x 10000 euro = 27% of profit acheived

The '% of profit achieved' was done in place on one strategy with 3 targets: with the currency settings in NT7 I would plug-in a value of '1' for PT2 and PT3 and the 10000 for PT3 to get the representative values for PT3 etc etc.
'Eyeballed' moneymanagement would likely give about a ratio of PT1 == 50-60000 euro, PT2 == 20-30000 euro and PT3 10-20000 euro on an 'average' day.

My feeling on all this is that there is more gained by having the 3 targets together as a help in not taking a lot of trades during non-profitable market chop sessions. Running PT2 alone is MORE profitable when all 30000 euro are applied to the target, and also has more consecutive losing trades, and also many more entries so there is some degree of added risk to use of that scenario (that statement is based on NOT re-optimizing on just the PT2 !). PT3 has same entry as PT1/2, but effectively is a different strategy because it has a longer term target and a trailing stop instead of the exit rules PT1/2 have. PT3 is less profitable that the combination of PT123 when all 30000 euro is applied to that target, but also has many fewer trades and as a result less likehood of as much slippage accumulation.

Different markets = different potentials. Different market activity, day to day, can be acknowledged within the same overal strategy. You like a basket of markets, I like a basket of strategys for 1 market (at least for now).

I am about to add 2 more targets that will use partially the entry rules that PT123 already use, but different trailing and exit conditions. Challenging, and time consuming, unfortunately lol

Regards,
TJ

Writing to you from the wonderful province of Ontario, Canada. Home to the world's biggest natural negative ion generator, the Niagara Falls, and to those that dare to know how to go over it in a barrel. SALUTE!
Reply With Quote
  #8 (permalink)
wown
Boston
 
Posts: 21 since Nov 2010
Thanks Given: 0
Thanks Received: 17

Tj- that sounds a lot like what i want to do. I think i would agree with uin saying one 1 target by itself wud probably not be profitable. In any case- aint nothin like testin it out myself.

Tj- could you provide some guidance on how you set that up?

Reply With Quote
  #9 (permalink)
 
Trader.Jon's Avatar
 Trader.Jon 
Near the BEuTiFULL Horse Shoe
 
Experience: Beginner
Platform: NinjaTrader
Broker: MBTrading Dukascopy ZenFire
Trading: $EURUSD when it is trending
Posts: 473 since Jul 2009
Thanks Given: 401
Thanks Received: 184


wown View Post
Tj- that sounds a lot like what i want to do. I think i would agree with uin saying one 1 target by itself wud probably not be profitable. In any case- aint nothin like testin it out myself.

Tj- could you provide some guidance on how you set that up?

What do you specifically need to know ... and have you checked out the strategies available in the Elite downloads?

Jon

Writing to you from the wonderful province of Ontario, Canada. Home to the world's biggest natural negative ion generator, the Niagara Falls, and to those that dare to know how to go over it in a barrel. SALUTE!
Reply With Quote
  #10 (permalink)
 baruchs 
Israel
 
Experience: Intermediate
Platform: NinjaTrader
Broker: pfg
Trading: eminis
Posts: 323 since Jun 2009


Hi TJ,
First I want to say that what you did, by testing each PT, is very good. If those are the results then of course do it like this. My point was that you need to test each target if it contributes to your profit or not.
Still I'm very skeptical about this approach. As you said I think that the biggest strength of automation is multi. Multi strategies/instruments/time frames.
The benefit of this is that because of lower correlation of the outcomes your draw down shrinks.
As you know I even demonstrated that with two absolutely negatively correlated strategies (correlation=-1) it can be beneficial to add a loosing strategy to a wining one.
Again the main issue is outcome correlation! Not instruments correlation, not time frame correlation.
I showed an actual beck test of one strategy on 20 different instruments with same parameters on same time frame. Apparently their outcome correlation was very small, hence the results.
Now lets check multi target approach in this sense. Lets do it with only 2 targets. I'm certain that you'll be able to extrapolate it to 3, 4 or 10 targets.
The possible outcomes of strategy with 2 targets:
1. Bigger target is met - then smaller is met too. Correlation 1.
2. Smaller target is not met (hit the stop) - bigger target is not met too. Correlation 1.
3. Smaller target is met, stop is moved to BE and second target not met. Correlation 0.
So you see in this approach the outcome correlation is too high. It is still smaller than 1. So go ahead and trade it.

Baruch,
p.s.
If you read my thread and saw my excel sheet, I told that the results are not correct. They were not correct because that test was on currency pairs, but done only on last (bid) price. When I added the ask price series the results were much worse. I hope you took this into your consideration.

Reply With Quote




Last Updated on March 9, 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