Login Page - Create Account

Support Board


Date/Time: Sat, 01 Jun 2024 21:20:31 +0000



[Programming Help] - alert formula

View Count: 428

[2023-08-02 19:37:28]
User120564 - Posts: 11
Hello,

For a LONG signal in automated trading I use: color bar based on alert condition.
crossing of 2 moving averages, the fast crosses the slow one upwards.
=CROSSFROMBELOW(ID1.SG1,ID2.SG1)
the formula works perfectly.
I would like to add the following additional condition:
The difference between the FAST moving average and the slow one during the crossing must be => 3 ticks between the 2 moving averages for the LONG signal to be validated, if the difference between the 2 moving averages is < 3 ticks: NO SIGNAL , NO TRADE.
THANK YOU for giving me the formula to automate this signal.

Jean-Luc LEBLANC
[2023-08-03 03:56:59]
Sawtooth - Posts: 4019
How can there be a crossover if the MAs are separated
Please explain further.
[2023-08-03 12:11:18]
User120564 - Posts: 11
once the crossover has been completed, the validation of the crossover as a signal is subordinate only if the fast moving average is equal to or greater than 3 ticks or more than the slow moving average = > 3 ticks.
example:
fast moving average: 15503
slow moving average: 15500
valid signal because the gap between the 2 moving averages IS HIGHER => 3 ticks.
fast moving average: 15502
slow moving average: 15500
signal NOT valid because the difference between the 2 moving averages is LOWER < 3 ticks.

THANK YOU for your help because I don't speak English.
[2023-08-03 13:50:13]
Sawtooth - Posts: 4019
Try this:
=AND(CROSSFROMBELOW(ID1.SG1,ID2.SG1),ID1.SG1-ID2.SG1>=TICKSIZE*3)
[2023-08-03 15:01:59]
User120564 - Posts: 11
it's not good, I have the message: alert formula error.
Thank you for your help.
[2023-08-03 18:15:04]
Sawtooth - Posts: 4019
That formula works for me in the Color Bar Based On Alert Condition study, without an error.
where:
ID1.SG1 is the fast MA
ID2.SG1 is the slow MA
[2023-08-04 16:00:09]
User120564 - Posts: 11
OK formula it's good, thank you very much. Apparently the crossing is valid only during the T candle and if the gap is less than 3 ticks = no signal: normal, at the T1 candle after the crossing which is still valid with more than 3 gap ticks I have no signal and the same for T2...
how can we do to have a signal during T1 when I did not have a signal at T because then I missed a trade. thank you for your help.
[2023-08-04 16:43:10]
Sawtooth - Posts: 4019
What is a T candle?

how can we do to have a signal during T1 when I did not have a signal at T because then I missed a trade.
Sorry, but I don't understand.
[2023-08-04 17:09:58]
User120564 - Posts: 11
Tcandle is the candle where the moving averages cross precisely, T1 is the candle after the crossing at T.
[2023-08-04 17:47:15]
Sawtooth - Posts: 4019
The CROSSFROMBELOW function will only be TRUE at a single candle.

Do you want a signal at all candles at and after the crossover, that also meet the 3 tick min separation?
[2023-08-05 10:15:54]
User120564 - Posts: 11
yes, that is exactly the signal i want. thank you very much.
[2023-08-05 13:23:47]
Sawtooth - Posts: 4019
Try this:
=AND(ID1.SG1>ID2.SG1,ID1.SG1-ID2.SG1>=TICKSIZE*3)
[2023-08-07 15:16:07]
User120564 - Posts: 11
perfect Formula for LONG and SHORT. THANK YOU SO MUCH.
Is it possible instead of COLOR BAR to replace with ARROW UP AND DOWN, I know it's not possible because I tried, maybe you know a way?
if it is impossible how can I on the same graph to add the price candles below in order to see the real candles. Thank you for explaining to me the path to follow for that.
[2023-08-07 15:48:39]
Sawtooth - Posts: 4019
Is it possible instead of COLOR BAR to replace with ARROW UP AND DOWN
You'd need two instances of the color bar study, one for each color/direction.
And follow these instruction to use Arrows instead of color bars:
Color Bar Based on Alert Condition: Drawing Arrows/Text or Other Styles at the High or Low of Bars
[2023-08-07 17:00:13]
User120564 - Posts: 11
THANK YOU that's OK, that's what I wanted.
a different question:
is it possible automatically from the opening time to the closing of the future u.s.a markets that a horizontal line tool of the lowest and one of the highest of each session move automatically with each new high or low of the day? instead of doing it manually.
[2023-08-07 18:00:14]
Sawtooth - Posts: 4019
the lowest and .. the highest of each session move automatically with each new high or low of the day?
Use the High/Low For Time Period study, and set 'Display High Low Incrementally' to Yes.
[2023-08-08 14:56:00]
User120564 - Posts: 11
Thank you, it works. Does putting this indicator on the automatic trading graph slow down the execution of trades or not?
another question:
when I open a position I have a sound, is it possible to choose a different sound for a gain output and another sound for a loss output?
[2023-08-08 21:03:14]
Sawtooth - Posts: 4019
Does putting this indicator on the automatic trading graph slow down the execution of trades or not?
Imperceptibly.

is it possible to choose a different sound for a gain output and another sound for a loss output?
Go to General Settings >> Notifications tab

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

Login

Login Page - Create Account