NexusFi: Find Your Edge


Home Menu

 





Donchian Scalper


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one trendwaves with 4 posts (5 thanks)
    2. looks_two tamerrashdan with 3 posts (0 thanks)
    3. looks_3 Big Mike with 2 posts (9 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 5,679 views
    2. thumb_up 15 thanks given
    3. group 3 followers
    1. forum 10 posts
    2. attach_file 14 attachments




 
Search this Thread

Donchian Scalper

  #1 (permalink)
 tamerrashdan 
New York
 
Experience: Beginner
Platform: NT
Broker: AMP/CQG
Trading: ES
Posts: 125 since Oct 2011
Thanks Given: 14
Thanks Received: 76

Attached, please find an automated strategy based on Donchian Channel
The strategy loses around $2000 a day and when reversed it loses around $4000 a day on TF 4-range chart with 10/10 tick target/stoploss
Can anyone take a look and suggest any changes to be made so that we can go against the reverse strategy at the same entry price +/- 1 tick so that instead of losing $4000 a day we can make even half that much
Please set T 51. UseDeltaStopLoss to False
I need to warn everybody against running this strategy or its reverse using real money as he will lose a lot of money for sure
Please let me know what you guys think
Thank you

Attached Files
Elite Membership required to download: PVDonchianScalper_source.zip
Follow me on Twitter Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Exit Strategy
NinjaTrader
New Micros: Ultra 10-Year & Ultra T-Bond -- Live Now
Treasury Notes and Bonds
Futures True Range Report
The Elite Circle
Better Renko Gaps
The Elite Circle
ZombieSqueeze
Platforms and Indicators
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
61 thanks
Funded Trader platforms
39 thanks
NexusFi site changelog and issues/problem reporting
26 thanks
The Program
18 thanks
GFIs1 1 DAX trade per day journal
18 thanks
  #3 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,396 since Jun 2009
Thanks Given: 33,172
Thanks Received: 101,536


Hopefully someone will help you.

If they do, then you will learn that this does not work.

You cannot take a losing strategy, reverse it, and turn it into a winning strategy. A losing strategy is a losing strategy.

If you kept every single trade identical, and just took the opposite position - fine. But that will never happen. And while you could program a backtest to do this, on historical data, it would never work going forward on live data/trading.

The reasons are many: slippage and news for one, and then a whole slew of psychological problems that exist even with automated strategies.

I am speaking from experience. I think every programmer that found a losing strategy probably tries to make it a winning strategy by reversing it.

Doesn't work. Instead, what ends up happening is you keep modifying the strategy, adding "filters" and so forth, until it's now overly curve fitted to historical data that has no bearing on the future market. This is where nearly all automated trading paths lead -- over curve fitting, and very few people truly understand it well enough to avoid it.

There are several good webinars on automated trading in the webinar section of futures.io (formerly BMT), including those by @kevinkdog, that are worth watching for a basic understanding of proper design and testing.

Hopefully others will give you their input as well.

Mike

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #4 (permalink)
 tamerrashdan 
New York
 
Experience: Beginner
Platform: NT
Broker: AMP/CQG
Trading: ES
Posts: 125 since Oct 2011
Thanks Given: 14
Thanks Received: 76

Thanks


Sent from my iPhone using Tapatalk

Follow me on Twitter Started this thread Reply With Quote
  #5 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,396 since Jun 2009
Thanks Given: 33,172
Thanks Received: 101,536


tamerrashdan View Post
Thanks

I do hope someone will do as you ask. Just reverse the EnterLong with EnterShort and so forth, and you'll see it doesn't work.

You could "force" it only by keeping an exact entry/exit time for every trade, and programatically taking the opposite position. But that is worthless and only would show useful on a backtest.

The reason swapping EnterLong and EnterShort doesn't work is simple.

Let's pretend (ignoring for a moment that scalping is a terrible method):

Trade #1 - Enter long @ 9am, exit for loss @ 9:30am
Trade #2 - Enter short @ 9:35am, exit for loss @ 9:40am
Trade #3 - Enter short @ 9:50am, exit for profit @ 9:58am

If you swap the EnterLong and EnterShort's it may look something like this:

Trade #1 - Enter short @ 9am, exit for loss @ 9:39am
Trade #2 - Enter long @ 9:48am, exit for loss @ 9:56am
Trade #3 - Enter short @ 10:04am, exit for loss @ 10:10am

See, everything changes because you flipped the signal. It's not a 1:1 relationship. This will be proven to you if someone makes the changes to your code.

Mike

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #6 (permalink)
 tamerrashdan 
New York
 
Experience: Beginner
Platform: NT
Broker: AMP/CQG
Trading: ES
Posts: 125 since Oct 2011
Thanks Given: 14
Thanks Received: 76

There is already a reverse option in the strategy
Problem is that the entry prices are different and trying to enter manually against the strategy sometimes doesn't work


Sent from my iPhone using Tapatalk

Follow me on Twitter Started this thread Reply With Quote
  #7 (permalink)
 
trendwaves's Avatar
 trendwaves 
Florida
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader 8
Trading: ES, NQ, CL
Posts: 703 since Dec 2012
Thanks Given: 2,898
Thanks Received: 2,525

I took a quick'ish look at your code just to get a feel for what you have going on.

I then ran a couple of quick tests on some historical data. I was not able to get your start time code to work properly, so my test runs include some pre-market trades.

I selected a random day in the middle of august and downloaded the TF replay data for that day. I have no idea what the chart looks like, just to keep my simple test unbiased.

I started with a 1 minute chart and set a few parameters, which generated a profit for the day. (See attached snapshot's for details). I set the profit target to 100 ticks, otherwise used your 10 tick stop loss. At first look the auto trail 1 and 2 didn't make any sense to me, I was not able to understand the intent of how it is supposed to work ?

I then set the reverse flag to True , and the result was a small loss for the day.

I then changed the time frame to 15 minutes and ran the reverse test again which produced a profit for the day.

I will go back and look at the code in relation to the reverse logic in specific for any idea to answer your actual question.





Be Patient and Trade Smart
Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #8 (permalink)
 
shodson's Avatar
 shodson 
OC, California, USA
Quantoholic
 
Experience: Advanced
Platform: IB/TWS, NinjaTrader, ToS
Broker: IB, ToS, Kinetick
Trading: stocks, options, futures, VIX
Posts: 1,976 since Jun 2009
Thanks Given: 533
Thanks Received: 3,709

A few words of advice

I would only take signals where the candle was at least 80% or more body, not so much wick. Also, did the candle close near the highs or lows of the bar? Think about it: if you have a candle that makes a new high/low, but it is rejected with counter selling/buying, then that's a weak breakout candidate. If a buy signal's bar closes on or near the highs, then it's a good buy signal. If it's retraces to a doji-like formation, weak entry. Look for volume patterns too.

Also, I wouldn't use fixed-tick targets/stops, use a percentage of ATR, that way it adjusts to the current market volatility regime. A 10 tick move in August was a lot easier to achieve than a 10 tick move in June.

Check when it works best (hours of the day, days of the week, etc). Beware of data-mining here though.

Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #9 (permalink)
 
trendwaves's Avatar
 trendwaves 
Florida
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader 8
Trading: ES, NQ, CL
Posts: 703 since Dec 2012
Thanks Given: 2,898
Thanks Received: 2,525

I applied Shodson's advice to the Dochian scalper strategy with respect to the 'reverse' logic and came up with this code and result...

 
Code
				if (reverse)
				{
					if ((DonchianChannel(period).Upper[1] > DonchianChannel(period).Upper[2]) && (High[0] < DonchianChannel(period).Upper[0]))
						ss = true;
					if ((DonchianChannel(period).Lower[1] < DonchianChannel(period).Lower[2]) && (Low[0] > DonchianChannel(period).Lower[0]))
						ls = true;
				}
				else
				{
					if (DonchianChannel(period).Upper[0] > DonchianChannel(period).Upper[1])   // can't be much simpler... 
						ls = true;
				
					if (DonchianChannel(period).Lower[0] < DonchianChannel(period).Lower[1])
						ss = true;
				}
				
				
				
				if (ls && ss && takeLongs && takeShorts){
					if (debug)
						PrintWithTimeStamp(this.Name + " Both long and short signal at same time, ignored");
					ls = ss = false;
				}
					
///				if (reverse){
///					bool tmp = ls;
///					ls = ss;
///					ss = tmp;
///				}



Be Patient and Trade Smart
Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #10 (permalink)
 
trendwaves's Avatar
 trendwaves 
Florida
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader 8
Trading: ES, NQ, CL
Posts: 703 since Dec 2012
Thanks Given: 2,898
Thanks Received: 2,525


This morning I modified the reverse code to look at only the Dochian channel in filtering the reversal signals. So, instead of looking at the current candle, the logic now compares the current channel level to the level for the previous bar.

The code and results are below, basically it had little effect on the strategy performance. I think this code/logic modification better maintains the original intent of the strategy author to have a pure (and simple) Dochian channel signal. Looking at or comparing candles drifts into interpreting price action and moves away from a pure Dochian channel signal.

 
Code
				
				if (reverse)
				{
					if ((DonchianChannel(period).Upper[1] > DonchianChannel(period).Upper[2]) && (DonchianChannel(period).Upper[0] == DonchianChannel(period).Upper[1]))
						ss = true;
					if ((DonchianChannel(period).Lower[1] < DonchianChannel(period).Lower[2]) && (DonchianChannel(period).Lower[0] == DonchianChannel(period).Lower[1]))
						ls = true;
				}
				else
				{
					if (DonchianChannel(period).Upper[0] > DonchianChannel(period).Upper[1])   // can't be much simpler... 
						ls = true;
				
					if (DonchianChannel(period).Lower[0] < DonchianChannel(period).Lower[1])
						ss = true;
				}



Be Patient and Trade Smart
Visit my NexusFi Trade Journal Reply With Quote
Thanked by:




Last Updated on September 8, 2015


© 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