Tom Demark Indicators

Just a quick query has anyone coded any demark indicators on Optuma?

Hey Mandeep, maybe we can work together to fine tune the code we are using as it’s close but not perfect. Are you familar with the rule’s for the Sequential/others? Im not as versed at the detailed rules so I’d be really happy if you can pick some holes in the codes below.
//Buy Countdown // Note the direction of the trend
bTrendDn = C < C[4];
bTrendUp = C > C[4];
// we need a signal when the trend changes
bTrendChangeDn = bTrendDn ChangeTo 1;
bTrendChangeUp = bTrendUp ChangeTo 1;
// if the trend is persistent, how many bars has it been
iBuySetupCnt = If(bTrendDn, TIMESINCESIGNAL(bTrendChangeDn) + 1, 0);
iSellSetupCnt = If(bTrendUp, TimeSinceSignal(bTrendChangeUp) + 1, 0);
// if we hit 9 then the setup is complete
bBuyComplete = IF(iBuySetupCnt == 9, 1, 0);
bSellComplete = if(iSellSetupCnt == 9, 1, 0);
// which mode are we in
bBuyMode = switch(bBuyComplete, bSellComplete);
// do we satisfy the countdown criteria bLow2 = C < L[2];
// how many valid countdown bars since the setup was complete
iBuyCountDown = if(bBuyMode, ACCSINCESIGNAL(bLow2, bBuyComplete), 0);
// if we hit 13 then the setup is complete
IF(iBuyCountDown < 14, iBuyCountDown, 0);
//Buy Setup
bTrendDn = C < C[4];
bTrendChange = bTrendDn ChangeTo 1;
iBuySetupCnt = If(bTrendDn, TIMESINCESIGNAL(bTrendChange) + 1, 0);
IF(iBuySetupCnt < 10, iBuySetupCnt, 9) > 6 and IF(iBuySetupCnt < 10, iBuySetupCnt, 9) < 10

//Sell Countdown
// Note the direction of the trend
bTrendDn = C < C[4]; bTrendUp = C > C[4];
// we need a signal when the trend changes
bTrendChangeDn = bTrendDn ChangeTo 1;
bTrendChangeUp = bTrendUp ChangeTo 1;
// if the trend is persistent, how many bars has it been
iBuySetupCnt = If(bTrendDn, TIMESINCESIGNAL(bTrendChangeDn) + 1, 0);
iSellSetupCnt = If(bTrendUp, TimeSinceSignal(bTrendChangeUp) + 1, 0);
// if we hit 9 then the setup is complete
bBuyComplete = IF(iBuySetupCnt == 9, 1, 0);
bSellComplete = if(iSellSetupCnt == 9, 1, 0);
// which mode are we in
bSellMode = switch(bSellComplete, bBuyComplete);
// do we satisfy the countdown criteria bHigh2 = C > H[2];
// how many valid countdown bars since the setup was complete
iSellCountDown = if(bSellMode, ACCSINCESIGNAL(bHigh2, bSellComplete), 0);
// if we hit 13 then the setup is complete;
IF(iSellCountDown < 14, iSellCountDown, 0);

//Sell Setup bTrendUp = C > C[4];
bTrendChange = bTrendUp ChangeTo 1;
iSellSetupCnt = If(bTrendUp, TIMESINCESIGNAL(bTrendChange) + 1, 0);
IF(iSellSetupCnt < 10, iSellSetupCnt, 9) > 6 and IF(iSellSetupCnt < 10, iSellSetupCnt, 9) < 10

Hi Chad,

Thanks for your reply - I have coded quite a simple version - I’ll check out your version this weekend. Mine is based on the fact that Demark is really looking at trends which are based on a 1 period moving average offset by 4 bars. 9 days above this or below this kicks off his trend and exhaustion signals. Here is my code for this:

UP signal = plots an indicator below the charts

a1 = close() < offset(ma(BARS=1), OFFSET=4);

timesincesignal(a1)

Down Signal

a1 = close() > offset(ma(BARS=1), OFFSET=4);

timesincesignal(a1)

My chart setup has this 4 period offset 1 period MA and the above indicators. I then check for either 9’s and 13’s days above or below this trend - using a showbar.

Hey Mandeep, I’ve tried to get your code to work, but Im having trouble getting anything to show up on my charts. Are you able to get yours to work? Do you mind sending me a screen shot of the chart and the indicators you have on it (click the pull out menu on the chart to reveal the right side structure panel). Also, does your offset need to be a -4?

Thanks.

 

 

Hey Mandeep thought this screen shot might be more helpful to you for the Demark code I am using for the countdown 9. As I mentioned, it’s not perfect so maybe between your code and this we can figure out a good indicator.

 

 

Hey Mandeep, I got your code to work by removing the a1 reference and just putting the code into the timesincesignal and using the close() function rather than the MA.

Timesincesignal(close() > close(OFFSET=4))

 

The next step for me is seeing if can run a breadth screen on all the stocks in a list that are showing an 8,9, 0r 13. Have you tried this or thought about that?

 

A screen on Timesincesignal(close() > close(OFFSET=4)) =8 or 9 or 10 or something like that?

 

 

Has anyone had any success getting this to work? I am not that familiar with coding but would love to use the TD indicator.