NexusFi: Find Your Edge


Home Menu

 





Seeking collaborator on statistical swing predictor


Discussion in NinjaTrader

Updated
    1. trending_up 3,698 views
    2. thumb_up 4 thanks given
    3. group 1 followers
    1. forum 4 posts
    2. attach_file 8 attachments




 
Search this Thread

Seeking collaborator on statistical swing predictor

  #1 (permalink)
 
cclsys's Avatar
 cclsys 
Sydney, NS
 
Experience: Intermediate
Platform: Ninja
Broker: Zen-Fire
Trading: TF,S,GC
Posts: 605 since Nov 2009
Thanks Given: 248
Thanks Received: 393

Look, I can plug along at certain things but then others go beyond my programming skills. I was long out of school before computers came on the scene. I use them (too much), but don't know programming really unless I can copy something that somebody else wrote.

I like stats though I haven't thought about them much in terms of indicators etc. usually getting them from strategy tests. But since I don't/can't run strategies in Ninja, I've let them go of late.

Tonight I coded in a simple 'Donchian Ratio' indicator and it is looking promising in the stats department. It's first prediction which seemed off to me was accurate to within one tick. (that was just chance since the prediction changes frequently).

But using the Donchian for what I really want to do is not ideal.

Indy started with just seeing difference between an average donchian range and the current range. But what I really want to do is count the average range of upswings in uptrend and downswings in downtrend and then put that out as statistics with projections in a window.

I attach the current Donchian ratio indicator as a starting point but am hoping someone with coding skills could take it and make a totally new edition which does the swing counts. I suspect one needs to have a loop command - something I have never got comfortable working with - so that there is some sort of variable int that is the swing count, some sort of counter and then the loop tells it to count back the last, say, 10 swings and divide them by the counter, but in this case do one loop for upswings in uptrends, one for downswings in uptrends, one for upswings in downtrends and one for downswings in downtrends. How one defines trend is tricky, but probably something simple like the nexusfi.com (formerly BMT) sloping up 3 bars in a row at least is fine. Mike's wave indicator which uses swings has a trend determinant and I suspect that would be better because the MA's can change direction within swings and that might balls everything up.

So the idea is to have some simple stats along the lines I have already coded quickly tonight being very unused to this.

Current range versus average so avg expectancy high-low on this bar versus actual high low. Simple.

Then once a new upswing has started, project the avg upswing in uptrend and/or downtrend and show it as a target price, also distance of current close to that price.

If anyone gets really inspired, I think it would be good to record swings as a ratio of 108 bar ATR (i.e. not fast 14 bar ATR which is wild) and then base projections on that average ratio versus tick number. Or percentage of price versus point number. Or even fancier: have ratio of ATR expanding/contracting and apply that ratio to the projection with high and low projection above/below the straight number.

This 'prediction' is not so much trying to nail the future down, rather to give statistical context to current price and direction which should help guide not so much entries but exits.

Btw the original idea for the indicator was to see if the expansion of the current Donchian range beyond a slower average would indicate acceleration exhaustion. It's not perfect and I don't tend to use indicators like this, but actually it's not bad. Whilst it is expanding (current above average and rising) moves (up or down) don't tend to stop right there, but when it stops, it quickly starts contracting - much faster than most MA's for example. The Donchians are actually quite informative things, simple as they are. Come to think of it, the Donchian Mean is probably as good a trend indicator as it is since only if market is making new highs or new lows does it usually start to move consistently. But that's not always the case. Sometimes market stalls and the previous lows going outside the period length disappear so the mean keeps rising (after an upmove) even though in fact nothing is going on. But it won't start falling until lower lows are being made so it won't whip around as much as an MA again.





Note the low prediction ('AvgExpect: 1180.6) in the first pic: that was about 1 minute after I had coded it. Then note the overnight low in the second pic (1180.7). Not bad! but also lucky...

Attachment: current Donchian ratio indicator with stats.
2 pics taken tonight as I was writing it, sort of before and afters.

PS. 6.43 am: another prediction nailed to within 1-2 ticks. In fact it had about a 5 tick variance for a while and the recent RH was right in the middle. This is beginning to look like more than luck. Maybe it's common sense? Of course often it's going to be much less or much more than 'predicted' but that is useful information too...

PPS 708: changed indicator to plot on chart with prediction lines and now trying to base them on donchian swing average + recent swing low or dsa - recent swing high. I think not quite right but pulled an all-nighter and time for a nap.

I think this is looking promising though.



Attached Files
Elite Membership required to download: DonchRatio1.zip
Elite Membership required to download: DonchianPredictorChart.zip
Visit my NexusFi Trade Journal Started this thread Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
Exit Strategy
NinjaTrader
Trade idea based off three indicators.
Traders Hideout
Better Renko Gaps
The Elite Circle
NexusFi Journal Challenge - May 2024
Feedback and Announcements
How to apply profiles
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
43 thanks
Just another trading journal: PA, Wyckoff & Trends
30 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
23 thanks
GFIs1 1 DAX trade per day journal
21 thanks
  #2 (permalink)
 
cclsys's Avatar
 cclsys 
Sydney, NS
 
Experience: Intermediate
Platform: Ninja
Broker: Zen-Fire
Trading: TF,S,GC
Posts: 605 since Nov 2009
Thanks Given: 248
Thanks Received: 393

Made progress with underlying Donchian. Picture attached. When ready indicator will be shared in Elite section. It works MUCH better than I thought. All based on ATR and Donchians, my two favorite sources of current market statistics, aka 'indicators'.



Visit my NexusFi Trade Journal Started this thread Reply With Quote
Thanked by:
  #3 (permalink)
 
websouth's Avatar
 websouth 
Perdido Beach, AL
Market Wizard
 
Experience: Intermediate
Platform: graph paper
Trading: The shiny stuff
Posts: 1,209 since Jul 2009
Thanks Given: 1,116
Thanks Received: 1,335


Neat stuff you are working on ccl. You might look at the code in mikes nexusfi.com (formerly BMT)Bands in the elite section to borrow some code from/ err I mean help with some of your ATR stuff.... (This is an older bands indicator which I like)





Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #4 (permalink)
 
cclsys's Avatar
 cclsys 
Sydney, NS
 
Experience: Intermediate
Platform: Ninja
Broker: Zen-Fire
Trading: TF,S,GC
Posts: 605 since Nov 2009
Thanks Given: 248
Thanks Received: 393

yes, very nice. Smooth and helpful. My attempt here is to get the expansion/contraction on both range and atr to show probable extensions in SR without too much smoothing. I would prefer straight stats on swings from which to make simpler bands just to show quickly when the market is failing or exceeding its averages. But to do that I have to collect swings and have not yet got there. Am hoping Cory's and Mikes waves/UTC work will provide the base for this so that I can simply add in some code that counts the swings, averages out their values and from there can plot these average projections with perhaps a little variability from ATR expansion/contraction ratio.

Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #5 (permalink)
 
cclsys's Avatar
 cclsys 
Sydney, NS
 
Experience: Intermediate
Platform: Ninja
Broker: Zen-Fire
Trading: TF,S,GC
Posts: 605 since Nov 2009
Thanks Given: 248
Thanks Received: 393


websouth View Post
Neat stuff you are working on ccl. You might look at the code in mikes nexusfi.com (formerly BMT)Bands in the elite section to borrow some code from/ err I mean help with some of your ATR stuff.... (This is an older bands indicator which I like)





Your picture of the two period bands reminded me of the classic use of bands in the old days - slow and fast. So I put up 2 of my own like that on Gold 5 min - which has been a bit wild the past few sessions as it is in quasi parabolic mode (in weekly timeframe).

The LT band is Mike's collective MA with a 1.382 band (basis price and ATR quotient).
The ST band is a ZeroLag 5 with .5.

It doesn't really matter what the settings are, the idea is to have both bands contain most of the price, but the ST tends to fit inside the longer term one most of the time. (When it doesn't, it's a very strong trend of course). But that way you see the longer term typical S/R providing context for the ST oscillations which are usually what day traders have to pay most attention to in terms of stops and PTs, especially the former.

It's a classic technique, very dull, but quite powerful in terms of contextualising current market situation. Not much to do with this issue per se, but your photo reminded me of that approach.






Visit my NexusFi Trade Journal Started this thread Reply With Quote




Last Updated on November 30, 2009


© 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