Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

Indicator-based ratio Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
0002ct
Posted : Friday, February 15, 2019 11:02:54 AM
Registered User
Joined: 11/19/2015
Posts: 459

Hello.

I want to evaluate a ticker over time using the DSS indicator. I'd like to know the total price change indicated by the first green in a series and closed by the first red, using open prices for both values, say for 250 bars.

The example below boxes DSS indicator's signals and a line traing the general barpath. I didn't do it exhaustively, and this is a only a few of the "green" examples.

1. If possible, I would like help with a formula for the "green" sum over 250 bars = UPS
2. A secod formula for "red" (first red is the start, first green closes the calculation) over 250 bars = DOWN
3. A third formula/ratio to compare the two = UPSDOWNS, over 250.

I am not certain whether this should be in percent-change or not, but I think this would be best since it will make comparison of other tickers easier.

Thank you very much for taking a look. 

____
What I use for Green:
100 * XAVG((XAVG(STOC10, 5) - MIN(XAVG(STOC10, 5), 10)) / (MAX(XAVG(STOC10, 5), 10) - MIN(XAVG(STOC10, 5), 10)), 5)

What I use for Red:
100 * XAVG((XAVG(STOC10, 5) - MIN(XAVG(STOC10, 5), 10)) / (MAX(XAVG(STOC10, 5), 10) - MIN(XAVG(STOC10, 5), 10)), 5) / ABS(XAVG((XAVG(STOC10, 5) - MIN(XAVG(STOC10, 5), 10)) / (MAX(XAVG(STOC10, 5), 10) - MIN(XAVG(STOC10, 5), 10)), 5) < XAVG((XAVG(STOC10.1.1, 5) - MIN(XAVG(STOC10.1.1, 5), 10)) / (MAX(XAVG(STOC10.1.1, 5), 10) - MIN(XAVG(STOC10.1.1, 5), 10)), 5))

What I use to draw the line:
100 * XAVG((XAVG(STOC10, 5) - MIN(XAVG(STOC10, 5), 10)) / (MAX(XAVG(STOC10, 5), 10) - MIN(XAVG(STOC10, 5), 10)), 5)
 

 

 




 

Bruce_L
Posted : Friday, February 15, 2019 12:09:39 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

So you want from the close of the first green dot to the close of the first red dot?

SUM(IIF(XAVG((XAVG(STOC10.1.1, 5) - MIN(XAVG(STOC10.1.1, 5), 10)) / (MAX(XAVG(STOC10.1.1, 5), 10) - MIN(XAVG(STOC10.1.1, 5), 10)), 5) > XAVG((XAVG(STOC10.1.2, 5) - MIN(XAVG(STOC10.1.2, 5), 10)) / (MAX(XAVG(STOC10.1.2, 5), 10) - MIN(XAVG(STOC10.1.2, 5), 10)), 5), C - C1, 0), 250)

And the close of the first red dot to the close of the first green dot?

SUM(IIF(XAVG((XAVG(STOC10.1.1, 5) - MIN(XAVG(STOC10.1.1, 5), 10)) / (MAX(XAVG(STOC10.1.1, 5), 10) - MIN(XAVG(STOC10.1.1, 5), 10)), 5) < XAVG((XAVG(STOC10.1.2, 5) - MIN(XAVG(STOC10.1.2, 5), 10)) / (MAX(XAVG(STOC10.1.2, 5), 10) - MIN(XAVG(STOC10.1.2, 5), 10)), 5), C - C1, 0), 250)

You can obviously do a ratio by just putting a / between the two formulas.

SUM(IIF(XAVG((XAVG(STOC10.1.1, 5) - MIN(XAVG(STOC10.1.1, 5), 10)) / (MAX(XAVG(STOC10.1.1, 5), 10) - MIN(XAVG(STOC10.1.1, 5), 10)), 5) > XAVG((XAVG(STOC10.1.2, 5) - MIN(XAVG(STOC10.1.2, 5), 10)) / (MAX(XAVG(STOC10.1.2, 5), 10) - MIN(XAVG(STOC10.1.2, 5), 10)), 5), C - C1, 0), 250) / SUM(IIF(XAVG((XAVG(STOC10.1.1, 5) - MIN(XAVG(STOC10.1.1, 5), 10)) / (MAX(XAVG(STOC10.1.1, 5), 10) - MIN(XAVG(STOC10.1.1, 5), 10)), 5) < XAVG((XAVG(STOC10.1.2, 5) - MIN(XAVG(STOC10.1.2, 5), 10)) / (MAX(XAVG(STOC10.1.2, 5), 10) - MIN(XAVG(STOC10.1.2, 5), 10)), 5), C - C1, 0), 250)

But I would probably just plot the price changes from the first green bar to the first red bar as a percentage of the price at the start of the period as a stand-in for long performance.

100 * SUM(IIF(XAVG((XAVG(STOC10.1.1, 5) - MIN(XAVG(STOC10.1.1, 5), 10)) / (MAX(XAVG(STOC10.1.1, 5), 10) - MIN(XAVG(STOC10.1.1, 5), 10)), 5) > XAVG((XAVG(STOC10.1.2, 5) - MIN(XAVG(STOC10.1.2, 5), 10)) / (MAX(XAVG(STOC10.1.2, 5), 10) - MIN(XAVG(STOC10.1.2, 5), 10)), 5), C - C1, 0), 250) / C250

And an inverse version of this in red in the same pane and scale as a stand in for short performance.

100 * SUM(IIF(XAVG((XAVG(STOC10.1.1, 5) - MIN(XAVG(STOC10.1.1, 5), 10)) / (MAX(XAVG(STOC10.1.1, 5), 10) - MIN(XAVG(STOC10.1.1, 5), 10)), 5) < XAVG((XAVG(STOC10.1.2, 5) - MIN(XAVG(STOC10.1.2, 5), 10)) / (MAX(XAVG(STOC10.1.2, 5), 10) - MIN(XAVG(STOC10.1.2, 5), 10)), 5), C1 - C, 0), 250) / C250

Summing these values would give you a measure of a combined long and short strategy over the period (I might plot this in white or yellow).

100 * (SUM(IIF(XAVG((XAVG(STOC10.1.1, 5) - MIN(XAVG(STOC10.1.1, 5), 10)) / (MAX(XAVG(STOC10.1.1, 5), 10) - MIN(XAVG(STOC10.1.1, 5), 10)), 5) > XAVG((XAVG(STOC10.1.2, 5) - MIN(XAVG(STOC10.1.2, 5), 10)) / (MAX(XAVG(STOC10.1.2, 5), 10) - MIN(XAVG(STOC10.1.2, 5), 10)), 5), C - C1, 0), 250) + SUM(IIF(XAVG((XAVG(STOC10.1.1, 5) - MIN(XAVG(STOC10.1.1, 5), 10)) / (MAX(XAVG(STOC10.1.1, 5), 10) - MIN(XAVG(STOC10.1.1, 5), 10)), 5) < XAVG((XAVG(STOC10.1.2, 5) - MIN(XAVG(STOC10.1.2, 5), 10)) / (MAX(XAVG(STOC10.1.2, 5), 10) - MIN(XAVG(STOC10.1.2, 5), 10)), 5), C1 - C, 0), 250)) / C250

Note, this isn't backtesting and the results are not the actual returns you would get, but it can compare the three strategies to each other and the comparisons should be relatively valid across stocks.

Adjusting all instances of 250 in the formula to something else would adjust the period.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
0002ct
Posted : Friday, February 15, 2019 12:12:32 PM
Registered User
Joined: 11/19/2015
Posts: 459

Bruce, superb. Yes, I know this isn't backtesting -- I do that exhaustively and with a totally different set of criteria and processing. I'm looking for a framework for comparing, which is exactly what you solved.

I'll dig into these to see how they work. Thanks very much. Much appreciated.

Bruce_L
Posted : Friday, February 15, 2019 12:20:45 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

I might actually add a 250 period rate of change percent indicator to the same pane and scale to compare the strategies to buy and hold.

100 * (C / C250 - 1)

Then again, all of these plots in the same pane starts to get a bit busy.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
0002ct
Posted : Friday, February 15, 2019 5:03:08 PM
Registered User
Joined: 11/19/2015
Posts: 459

Bruce, I just got back and you're probably gone. Thank you very much for the follow up. Adding a ROC to my views isn't distracting. You should see the Norad I have going on sometimes. By the time you see this, hope you had a good weekend.

Bruce_L
Posted : Friday, February 15, 2019 7:28:27 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

You're welcome.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Users browsing this topic
Guest-1

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.