Login Page - Create Account

Support Board


Date/Time: Thu, 26 Sep 2024 23:31:37 +0000



[Programming Help] - Spreadsheet for trading routinely misses entry triggers

View Count: 137

[2024-08-30 03:41:35]
User745789 - Posts: 255
Please see attached image. The value in cell O3 is rounded using =round(AA3, 2). It is exactly -0.05 in value.

Yet K3 had a value of zero, no entry triggered.

This trade was triggered only when cell O3 == -0.06.

What is going wrong? Why was the value of -0.05 ignored?
Date Time Of Last Edit: 2024-08-30 04:11:48
imageSC image.png / V - Attached On 2024-08-30 03:41:45 UTC - Size: 5.84 KB - 30 views
[2024-08-30 14:19:35]
Sawtooth - Posts: 4092
Why was the value of -0.05 ignored?
Does =O3=-0.05 return TRUE/1 in your example?

This thread might explain why:
When comparing a FRACTIME to a TIMEVALUE, the >= operator ignores the =
[2024-09-02 04:16:27]
User745789 - Posts: 255
Does =O3=-0.05 return TRUE/1 in your example?

Yes, while =O3<=-0.05 does not.

It seems that thread relates very much to what I am seeing.

All I am doing is counting the number of ticks, how can there be a floating-point error? I am not doing any calculation to derive -0.05 other than the difference between two prices.
[2024-09-02 04:29:38]
Sawtooth - Posts: 4092
All I am doing is counting the number of ticks, how can there be a floating-point error?
Some symbol prices have floating point errors, especially if the tick size is small.

This is what I do:
First, remove any floating point errors in the tick size
Then reference the new tick size to remove any floating point errors in the price.

Spreadsheet Example Formulas and Usage: Removing Floating Point Imprecision

I take it a step further, and use columns AB-AE, (relative to columns B-E) so that it's easier to remember the MROUNDed prices.
[2024-09-02 04:51:41]
User745789 - Posts: 255
Thank you. You are right, rather than 0.01, the tick size in J21 is 0.009999999776482582.
[2024-09-02 13:31:19]
Sawtooth - Posts: 4092
You can also avoid using H21 and do this, in columns AB-AE:
=MROUND(B3,1/ROUND(1/$J$21,0))
=MROUND(C3,1/ROUND(1/$J$21,0))
=MROUND(D3,1/ROUND(1/$J$21,0))
=MROUND(E3,1/ROUND(1/$J$21,0))
[2024-09-03 00:14:53]
User745789 - Posts: 255
Thank you. In my use case I am not sure rounding in H21 for J21 will help. My simple system is operating on a swing value, and I have already been rounding that using =ROUND(), but that was not accomplishing what I thought it was I will try =MROUND, as it rounds to tick size, which I did not previously know.

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

Login

Login Page - Create Account