Z-Score + Ergodic = Trend following profit system?

T

tradebyday

Active member
Hello everyone,

I am new to the community but not new to this page. I have been skulking the threads here the better part of 2 years now and have liked quite a few things you guys have both utilized and created. I am reaching out to this wonderful community in hopes to gain some assistance, some insight, and hopefully a fully automated alert system into my trading regimen to test out. I will post the links to the 2 indicators I am using at the bottom of this text. Now for the details. Trading off the 4000tick chart for /ES futures, I have developed a system I am rather proud of, but need help in trying to make it a more compact system. The way it works is rather simple, when z-score and Ergodic are both > 0, Its a long entry, when they are both < 0, its a short entry. I have settings that work very well for me, but I want to leave the system customizable as the indicators are right now. But what I would like to do is combine the indicators into a strategy that I can apply 3 ATR TPs, and leave the exit to being a reverse signal of the z-score. So say I enter a long, TP at 2*ATR, 4*ATR, and 7*ATR, then my stop loss or exit signal would just be when z-score is <0. The other thing I would like to accomplish with the strategy is to paint arrows for the 3 functions, green for bullish entry, red for bearish entry, and pink for exits. I am not too versed in the capabilities of coding so if this is not all doable I understand, but any help would be appreciated!

This is my current workspace (yes it is a bit of a mess as i have been playing around with some extra stuff on daily charts haha).

https://tos.mx/NzFimxi
 
T

tradebyday

Active member
It has come to my attention this link does not provide the z-score i am using. Such a shame. It can be found below
Code:
# Zscore
# Mobius
# Chat Room Request for mean reversion oscillator
#hint: Zscore measures distance from mean. Study allows the user to pick different aggregations than the chart aggregation and different lengths for the calculations.
# Discussion: Good use is as a reversion to mean oscillator. On lower aggregations (5min and less) Zscore can be so jumpy that it's near useless. But using it several aggregations higher than your trade time can make it useful. For 2 min charts setting Zscore to 15 min gives a nice confirmation to a pivot signal where Zscore is 3 or better for instance.

declare lower;

input length = 48;
input Agg = {default current, min5, min15, min30, daily};

def t;
switch (Agg){
case current:
    t = close;
case min5:
    t = close(period = AggregationPeriod.Five_min);
case min15:
    t = close(period = AggregationPeriod.Fifteen_Min);
case min30:
    t = close(period = AggregationPeriod.Thirty_Min);
case daily:
    t = close(period = AggregationPeriod.Day);
}
def c = close;
plot Zscore = (t - Average(t, length)) / StDev(t, length);
     Zscore.SetDefaultColor(Color.PLUM);
plot zero = if isNaN(c) then double.nan else 0;
     zero.SetDefaultColor(Color.Black);
     zero.SetLineWeight(1);
     zero.HideTitle();
plot PosOne = if isNaN(c) then double.nan else 1;
     PosOne.SetDefaultColor(Color.Green);
     PosOne.HideTitle();
plot NegOne = if isNaN(c) then double.nan else -1;
     NegOne.SetDefaultColor(Color.Light_Red);
     NegOne.HideTitle();
plot PosTwo = if isNaN(c) then double.nan else 2;
     PosTwo.SetDefaultColor(Color.Green);
     PosTwo.HideTitle();
plot NegTwo = if isNaN(c) then double.nan else -2;
     NegTwo.SetDefaultColor(Color.Red);
     NegTwo.HideTitle();
plot PosThree = if isNaN(c) then double.nan else 3;
     PosThree.SetDefaultColor(Color.Dark_Green);
     PosThree.HideTitle();
plot NegThree = if isNaN(c) then double.nan else -3;
     NegThree.SetDefaultColor(Color.Dark_Red);
     NegThree.HideTitle();
AddCloud(zero, PosOne, Color.Light_Green, Color.Light_Green);
AddCloud(PosOne, PosTwo, Color.Green, Color.Green);
AddCloud(PosTwo, PosThree, Color.Dark_Green, Color.Dark_Green);
AddCloud(NegOne, zero, Color.Light_Red, Color.Light_Red);
AddCloud(NegTwo, NegOne, Color.Red, Color.Red);
AddCloud(NegThree, NegTwo, Color.Dark_Red, Color.Dark_Red);
# End Code Zscore
https://tos.mx/jXHKqap
 
samiranadhikari

samiranadhikari

Member
Good setup! I just added RSI crossover (available in thinkorswim) signal and it is able point great entry point...
 
samiranadhikari

samiranadhikari

Member
Look the signals are coming below the cloud and after sometime went above the cloud!
 
T

tradebyday

Active member
I feel that is not a good indication when the market returns to what used to be "normal". It works for now because the new normal is just pump pump pump. I am looking for the edge during the good and the bad times
 
samiranadhikari

samiranadhikari

Member
5-13 ema crossover at daily ES chart (downward) or price going below 20 or 50 sma may be considered as conditions against RSI bye signal . One can look at monthly or weekly VWAP for guidance.
 
T

tradebyday

Active member
It is not a bad find, I think I prefer the one I posted above just because it is adjustable for both aggregation and period length, though very similar, so I am sure it would yield decent results. I was going to further post on my previous idea until I had discovered some stuff created by one of the members here. It has allowed me earlier entries so I capture more of the trend, however I do believe the z-score is a great tool to have in the back pocket for scalpers
 
television

television

Member
hey, tested this out setup out and its looking promising! do you still utilize this system? also, in your workspace you have 2 ergodic oscillators one that is 100,50,10 and another that is 40,10,8... do you only require one of them to be green along with the zscore being over 0 or do you look for both oscilators to be above 0
 
T

tradebyday

Active member
@television, at the time I was trying to figure out which settings I preferred over the other, so you do not need both. Though I do not trade this system anymore, it was still useful at the time
 

Similar threads

Top