Support Board
Date/Time: Sat, 11 Jan 2025 06:10:26 +0000
[Programming Help] - Spreadsheet Trading CROSSOVER/ABOVE/BELOW Question
View Count: 1623
[2016-11-01 02:50:16] |
doctor10 - Posts: 78 |
Basic question about CROSSOVER/ABOVE/BELOW. Is there a way to set a condition where if the lines touch(triggering an entrance or an exit)but do not end up crossing the system will go flat or reenter the previously held position? - D |
[2016-11-01 04:23:50] |
Sierra Chart Engineering - Posts: 104368 |
No. You really need to create your own custom formula to accomplish this rather than using the CROSS* functions. Furthermore, it is very unlikely when comparing floating point values to ever have a "touch/equal" condition. Sierra Chart Support - Engineering Level Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy: https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service: Sierra Chart Teton Futures Order Routing |
[2016-11-01 10:41:07] |
doctor10 - Posts: 78 |
well, I have it all the time. Hence the question. I take it you can't think of a way to accomplish this? Thanks for the help! |
[2016-11-01 11:06:17] |
doctor10 - Posts: 78 |
Your blase response pissed me off so bad i figured it out! thanks!
|
[2016-11-01 16:58:11] |
Sierra Chart Engineering - Posts: 104368 |
You need to write your own custom formula. Here is the source code for the crossover function which will help: int CrossOver(SCFloatArrayRef First, SCFloatArrayRef Second, int Index)
{ float X1 = First[Index-1]; float X2 = First[Index]; float Y1 = Second[Index-1]; float Y2 = Second[Index]; if (X2 != Y2) // The following is not useful if X2 and Y2 are equal { // Find non-equal values for prior values int PriorIndex = Index - 1; while (X1 == Y1 && PriorIndex > 0 && PriorIndex > Index - 100) { --PriorIndex; X1 = First[PriorIndex]; Y1 = Second[PriorIndex]; } } if (X1 > Y1 && X2 < Y2) return CROSS_FROM_TOP; else if (X1 < Y1 && X2 > Y2) return CROSS_FROM_BOTTOM; else return NO_CROSS; } Sierra Chart Support - Engineering Level Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy: https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service: Sierra Chart Teton Futures Order Routing |
To post a message in this thread, you need to log in with your Sierra Chart account: