Login Page - Create Account

Support Board


Date/Time: Tue, 23 Apr 2024 12:01:15 +0000



[User Discussion] - Converting a Slope Study Alert into Buy/Exit

View Count: 3197

[2014-03-15 02:17:07]
Litz - Posts: 131
Wish to thank jackw for posting change of slope alert of %D Simple or impossible alert question

Was wondering if is possible to convert the alert
(SG2 - SG2[-1]) * (SG2[-1] - SG2[-2]) < 0 into buy/exit formula for Spreadsheet System for trading so as to use change of slope of %D into trade signals. I currently use =AND($J$8<=0,CROSSFROMBELOW(AH3:AH5,AI3:AI5)) for generating entries based on %D %K crosses. Am looking to experiment further. Realize SC doesnt do coding but would appreciate any help/advice.

http://www.sierrachart.com/image.php?l=1394849776587.png

[2014-03-15 03:23:01]
Sawtooth - Posts: 3976
=(AB3-AB4)*(AB4-AB5)<0 is the equivalent of (SG2-SG2[-1])*(SG2[-1]-SG2[-2])<0
where AB is the same subgraph as SG2.



[2014-03-15 04:38:55]
Litz - Posts: 131
Thanks. So would this be the proper code for both buy entry and exit with each slope change triggering a trade?

=AND($J$8<=0,(AB3-AB4)*(AB4-AB5)<0))
Date Time Of Last Edit: 2014-03-15 04:39:44
[2014-03-15 05:35:12]
Sawtooth - Posts: 3976
Do a Chart >> Replay Chart (Standard Replay) and see what it does.

But first delete one closing parentheses:
=AND($J$8<=0,(AB3-AB4)*(AB4-AB5)<0)

I don't know if the formula is efficacious. I was only converting the alert formula to a spreadsheet formula.

Date Time Of Last Edit: 2014-03-15 05:42:05
[2014-03-15 12:04:30]
Litz - Posts: 131
Well, it does generate buys but immediate exits



http://www.sierrachart.com/image.php?l=139488572784.png

BTW, appreciate your input, website, and you dedication to SC

Date Time Of Last Edit: 2014-03-15 12:15:52
[2014-03-15 14:16:32]
Sawtooth - Posts: 3976
I would use a formula like this for signals at changes in the direction of slope:

K3:
=AND(AB5>AB4,AB3>AB4)
M3:
=AND(AB5<AB4,AB3<AB4)

If you want to always be in a position, leave L3 and N3 blank and set Support Reversals to Yes. However, this is not likely to be profitable so the conditions will need to be more sophisticated.


[2014-03-15 15:06:43]
Litz - Posts: 131
Yes. Trying that results in too many trades due to minor changes in slope creating many losing trades. One would have to limit trades to only large slope changes.

I see that you have worked on zigzag reversal alerts. Can these alerts be incorporated into Spreadsheet System for trading?
[2014-03-15 17:28:23]
Sawtooth - Posts: 3976
I see that you have worked on zigzag reversal alerts. Can these alerts be incorporated into Spreadsheet System for trading?

Yes, but the zigzag direction change doesn't paint for n bars so its usefulness is limited as an autotrading signal.

Try this:
K3:
=AND(O3,AA5>AA4,AA3>AA4,AA3<>0)
M3:
=AND(P3,AA5<AA4,AA3<AA4,AA3<>0)
O3:
=IF(AND(AG5>AG4,AG3>AG4),TRUE,IF(AND(AG5<AG4,AG3<AG4),FALSE,O4))
P3:
=IF(AND(AG5<AG4,AG3<AG4),TRUE,IF(AND(AG5>AG4,AG3>AG4),FALSE,P4))
where
AA is the Zigzag
AG is the %K

O3 and P3 will 'store' the %K direction change until it reverts.
K3 and M3 will not go TRUE until the zigzag also changes direction.
However, the arrows from K3 and M3 will not be historically accurate because of the ZZ repaint.



[2014-03-15 19:09:05]
Litz - Posts: 131
That seems to work on a short time frame. Have not tested it longer term. Adjusting the length of the %K to smooth it out and the size of the range bars seems to make a large difference in profitability although drawdowns are large.

Thanks again for your input. I barely passed fortran many moons ago.

I am discovering that long only or short only trades are most profitable when trading with the current trend and will work to incorporate a trend line variable into spreadsheet trading.
Date Time Of Last Edit: 2014-03-15 19:14:05
[2014-09-20 18:21:12]
User75277 - Posts: 33
Hi - I am using the attached study alert to paint bars on change of slope of the slow Stochastic. The study consists of the Stochastic and a Color Bar Based On Alert Condition:

(ID1.SG2 - ID1.SG2[-1]) * (ID1.SG2[-1] - ID1.SG2[-2]) < 0

This seems to work for Volume based bar charts but not for Range or Renko-Flex (does not seem to work at all for tick based charts but I do not use those).

My objective: is to (1) fix this so it can detect slope change all the time and (2) pass the two kinds of slop change (turn up and turn down) to another range chart (my Main price chart) so I can have a graphic display on my Main price chart.

Any help is appreciated. Thanks in advance. :)


attachmentSlopeChange.StdyCollct - Attached On 2014-09-20 18:19:57 UTC - Size: 18.68 KB - 431 views
imageCHART OF SLOPE CHANGE STUDY COLLECTION WHICH DOES NOT WORK O.png / V - Attached On 2014-09-20 18:20:28 UTC - Size: 74.98 KB - 534 views
Attachment Deleted.
Attachment Deleted.
Attachment Deleted.
[2014-09-21 03:25:05]
Sawtooth - Posts: 3976
I think the formula is not considering equal slopes.

I would use a formula like this for signals at changes in the direction of slope:

OR(AND(ID1.SG2[-2]>ID1.SG2[-1],ID1.SG2>ID1.SG2[-1]),
AND(ID1.SG2[-2]<ID1.SG2[-1],ID1.SG2<ID1.SG2[-1]),
AND(ID1.SG2[-2]=ID1.SG2[-1],ID1.SG2>ID1.SG2[-1]),
AND(ID1.SG2[-2]=ID1.SG2[-1],ID1.SG2<ID1.SG2[-1]))

This can be shortened to:
OR(AND(ID1.SG2[-2]>=ID1.SG2[-1],ID1.SG2>ID1.SG2[-1]),
AND(ID1.SG2[-2]<=ID1.SG2[-1],ID1.SG2<ID1.SG2[-1]))

This will alert at every change in direction (up to down, down to up, equal to up, equal to down), and it should work for any bar type.
Date Time Of Last Edit: 2014-09-21 15:09:30

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account