- Joined
- 28 December 2013
- Posts
- 6,362
- Reactions
- 24,248
I can understand how to Control Risk
"It is not about adding on, but taking away. The less technique, the better you are." - Bruce Lee
during periods of low trading activity, the values of simple moving averages (SMA) & the volume-weighted moving average (VWMA) are almost similar. Knowing this can be used to your advantage.
Markets make a difference when it comes to profitability
Some indicators work better in certain market types but the volume-weighted moving average (VWMA) works in all types of markets. How does it do that? The (VWMA) picks its time to punch, meaning it's very selective when entering a position. Being selective means the indicator will only take "signals in trends" that are "confirmed to be bullish". As I said in my previous post a "bullish trend" is confirmed when the (VWMA) is above the (SMA). Using the same length of both indicators is critical for this confirmation.
Historical data
Using historical data is crucial when it comes to understanding the different types of market phases. When backtesting a (VWMA) strategy, great care should be exercised to note when the "VWMA Strategy" perform well. This step is important during the strategy development phase because this will indicate what has worked in the past & what's the probability it will work in the future.
Skate.
Just for general interest, this is the strategy that the US MMs use to fill big orders for Mutual Funds etc. It is early in a trend a pretty safe entry point as it usually means there will be big buyers alongside.
//*************************************************************
// Run an optimize on nullify_condition.
// All 4 tests should show exact same results. If they don't, then there is a leak.
// At the end, do a quick check to see if buy, sell signals have been messed with.
//
// NOTE = This is just a quick helper. It does NOT prove there are problems, or prove your formula is safe.
//
//
//*************************************************************
_TRACE("Starting Test ");
futureLeakTest = True; // use this to turn off the inner loop.
nullify_condition = Optimize("Future Null",1,1,4,1);
// 1 = Future quotes == Current Close
// 2 = Future quotes == 0 (Zero)
// 3 = Future quotes == NULL
// 4 = Future quotes == unchanged.
Buy = Sell = 0;
pr = .00001;
zzHiLo_test = Zig( c, pr ); // create an Original array to test against.
cc = Close; // cache the close
for( i = 0; i < BarCount-1; i++ )
{
C = cc; // Set the C back to the original.
//==============================================================================================
if (futureLeakTest) // Inner loop
for( t = i+1; t < BarCount; t++ ) // Loop through all future values From tomorrow onwards
{ // Note we ONLY modify future values, which shouldn't be known or used.
switch (nullify_condition)
{
case 1:
C[t] = C[t-1]; // Make future values non changing. ie, copy the last value. Usually the most stable.
break;
case 2:
C[t] = 0; // Sometimes we want it to be zero, although this will upset calculations. This might be what you want
break;
case 3:
C[t] = NULL; // Sometimes just NULL it. NOTE .. NULL and 0 are different in Amibroker, however most of the time produce the same results !!!
break;
case 4:
break; // C remains unchanged ie, do nothing. Will be the same as if
}
}
// Put your base arrays, or other formula for looping here to be calculated and tested for future leaks.
zz = Zig( C, pr ); // <== Note this is a modified Close array which Modifies future data.
zzHiLo[i] = zz[i];
}
C = cc;
// zzHiLo = Zig( c, pr ); <= Doing in the loop now to modify future data
pk = zzHiLo>Ref(zzHiLo,-1) AND zzHiLo>Ref(zzHiLo,1); //<==== testing tomorrows Zig(close,pr)
tr = zzHiLo<Ref(zzHiLo,-1) AND zzHiLo<Ref(zzHiLo,1); //<==== testing tomorrows Zig(close,pr)
SetTradeDelays(1,1,0,0);
BuyPrice=SellPrice=C;
Buy = tr;
Sell = pk;
Filter = 1;
AddColumn(C,"C",1.6,IIf(C==C,colorBlack,colorRed));
AddColumn(zzHiLo_test,"ZZ1",1.6,IIf(zzHiLo_test==C,colorBlack,colorRed));
AddColumn(zzHiLo,"ZZ2",1.6,IIf(C==zzHiLo,colorBlack,colorRed));
AddColumn(zzHiLo - zzHiLo_test,"Delta ZZ",1.6,IIf(zzHiLo_test==zzHiLo,colorBlack,colorRed));
Plot(zzHiLo,"",colorgreen,styleLine);
Plot(zzHiLo_test,"",colororange,styleLine);
_TRACE("Completed test");
Since you're using BHP daily, what would be a date where you'd argue it references future data and affects a backtest result? Just so I can run bar replay and check for myself.I finally got around to playing with the ZigZag indicator to end this matter once and for all.
I used GB's percentage of .00001.
Below is a snip of BHP. The Orange line is the Vanilla zigzag, The Green is zigzag with modified future data. In general the signals are delayed by a day when future data is modified.
I wrote the current bar to all future bars and calculated the current zig, in my code it's nullify_condition=1. The horizontal sections in the green are where zigzag is using future data and doesn't know where the turning point is, so it's horizontal and not sloping. In some cases it's up to 6 days away before the turning point is detected and always with a lag. So even with such a low percentage it can still make a significant impact.
View attachment 149167
And here is the code i used It could prove usefull to others one day.
Code://************************************************************* // Run an optimize on nullify_condition. // All 4 tests should show exact same results. If they don't, then there is a leak. // At the end, do a quick check to see if buy, sell signals have been messed with. // // NOTE = This is just a quick helper. It does NOT prove there are problems, or prove your formula is safe. // // //************************************************************* _TRACE("Starting Test "); futureLeakTest = True; // use this to turn off the inner loop. nullify_condition = Optimize("Future Null",1,1,4,1); // 1 = Future quotes == Current Close // 2 = Future quotes == 0 (Zero) // 3 = Future quotes == NULL // 4 = Future quotes == unchanged. Buy = Sell = 0; pr = .00001; zzHiLo_test = Zig( c, pr ); // create an Original array to test against. cc = Close; // cache the close for( i = 0; i < BarCount-1; i++ ) { C = cc; // Set the C back to the original. //============================================================================================== if (futureLeakTest) // Inner loop for( t = i+1; t < BarCount; t++ ) // Loop through all future values From tomorrow onwards { // Note we ONLY modify future values, which shouldn't be known or used. switch (nullify_condition) { case 1: C[t] = C[t-1]; // Make future values non changing. ie, copy the last value. Usually the most stable. break; case 2: C[t] = 0; // Sometimes we want it to be zero, although this will upset calculations. This might be what you want break; case 3: C[t] = NULL; // Sometimes just NULL it. NOTE .. NULL and 0 are different in Amibroker, however most of the time produce the same results !!! break; case 4: break; // C remains unchanged ie, do nothing. Will be the same as if } } // Put your base arrays, or other formula for looping here to be calculated and tested for future leaks. zz = Zig( C, pr ); // <== Note this is a modified Close array which Modifies future data. zzHiLo[i] = zz[i]; } C = cc; // zzHiLo = Zig( c, pr ); <= Doing in the loop now to modify future data pk = zzHiLo>Ref(zzHiLo,-1) AND zzHiLo>Ref(zzHiLo,1); //<==== testing tomorrows Zig(close,pr) tr = zzHiLo<Ref(zzHiLo,-1) AND zzHiLo<Ref(zzHiLo,1); //<==== testing tomorrows Zig(close,pr) SetTradeDelays(1,1,0,0); BuyPrice=SellPrice=C; Buy = tr; Sell = pk; Filter = 1; AddColumn(C,"C",1.6,IIf(C==C,colorBlack,colorRed)); AddColumn(zzHiLo_test,"ZZ1",1.6,IIf(zzHiLo_test==C,colorBlack,colorRed)); AddColumn(zzHiLo,"ZZ2",1.6,IIf(C==zzHiLo,colorBlack,colorRed)); AddColumn(zzHiLo - zzHiLo_test,"Delta ZZ",1.6,IIf(zzHiLo_test==zzHiLo,colorBlack,colorRed)); Plot(zzHiLo,"",colorgreen,styleLine); Plot(zzHiLo_test,"",colororange,styleLine); _TRACE("Completed test");
Any date period.Since you're using BHP daily, what would be a date where you'd argue it references future data and affects a backtest result? Just so I can run bar replay and check for myself.
Your coding will take me a while to understand, if I even get to that point. So that's a bit of a difficulty for me.View attachment 149180
To set the record straight
Someone "Fucknuckle" has lifted the avatar from my ASF profile page & made a Twitter profile to make it "look like it's me". I can assure everyone it's not me & I don't have a Twitter account.
I have just started reading Twitter recently. If I find something of "interest" I'll post it in this thread as I'm always on the lookout for new content. If a topic interests me it might interest others.
For a start
1. I don't have a Twitter account
2. I don't post on Twitter
3. I don't know Mo Bigun
4. I don't have any social media accounts
View attachment 149179
I have no idea what's going on
Twitter doesn't make much sense to me as it appears to be full of fluff with self-promotion. The content is not all that valuable IMHO but I'm sure it's an inexpensive way to sell goods & services.
I have no association with any of these posts
I have lifted the screenshots from Twitter to display how childish some can be. In essence, you have no control over false information being tweeted.
View attachment 149178
Skate.
To set the record straight
Someone "Fucknuckle" has lifted the avatar from my ASF profile page & made a Twitter profile to make it "look like it's me". I can assure everyone it's not me & I don't have a Twitter account.
Responding to a Twitter question
Just to clarify, I do not intend to open a Twitter account.
Responding to another Twitter question
Yes, I'm currently having a good year. Trading good strategies help in this regard.
Good afternoon/evening Skate,To set the record straight
Someone "Fucknuckle" has lifted the avatar from my ASF profile page & made a Twitter profile to make it "look like it's me". I can assure everyone it's not me & I don't have a Twitter account.
Skate.
Hello and welcome to Aussie Stock Forums!
To gain full access you must register. Registration is free and takes only a few seconds to complete.
Already a member? Log in here.