Login Page - Create Account

Support Board


Date/Time: Sun, 19 May 2024 13:08:39 +0000



[Programming Help] - How to flip trades between two conditions?

View Count: 610

[2020-01-11 00:01:49]
sourdubber - Posts: 52
Is it possible to alternate buy and sell orders for each bar starting from condition 1 to condition 2?

Consider the following.

07:00 : Condition 1 met - BUY
07:05 : SELL
07:10 : BUY
07:15 : SELL
07:20 : BUY
07:25 : Condition 2 met - SELL (if previous order was "SELL", then skip.)
Date Time Of Last Edit: 2020-01-11 00:03:55
[2020-01-11 03:04:11]
Sawtooth - Posts: 4000
You could use an absolute reference to $J$7 in your entry formulas.
[2020-01-11 03:41:48]
sourdubber - Posts: 52
You could use an absolute reference to $J$7 in your entry formulas.

Can you provide some example? How will SC know the prior order was a buy or a sell?

More importantly, I'm having the most problem with using the two conditionals in the formula. I stated above that I want to enter a trade after the first condition and exit after the second condition. But there is a twist.

Suppose I have four conditions, eg. conditions 1,2,3,4 and there's no specific order in which they appear. It's a complete random sequence (eg. 1,2,3,4...1,3,4,2...2,3,1,4...etc) So, for example, I get a sequence of 1,3,4,2, where 1 is the first condition and 2 is the second condition. So with condition 1, I would enter the trade and subsequently buy/sell/buy/sell until the condition 2 comes up. The problem is that between 1 and 2 there are 3 and 4. How can I maintain the rule of condition 1 and bypass conditions 3 and 4 until condition 2 is reached?

In another word, trade from Condition 1 to Condition 2 and ignore all other conditions in between. However, after Condtion 2, then resume following all conditions.

I hope that makes it clear and thanks for your help.
Date Time Of Last Edit: 2020-01-11 03:53:25
[2020-01-11 03:56:38]
Sawtooth - Posts: 4000
How will SC know the prior order was a buy or a sell?
J7 will be a positive value if the previous trade was long, and a negative value is the previous trade was short.

How can I maintain the rule of condition 1 and bypass conditions 3 and 4 until condition 2 is reached?
You'll need to create a persistent TRUE in a Formula Column for each condition, then release it with another condition, then in K3/M3 find the transitions from 0 to 1 for the signals.
There is no specific example of how to do this because each system is unique. But here are a few general examples:
Spreadsheet Example Formulas and Usage: Persistent and Incrementing Variables
[2020-01-11 05:05:11]
sourdubber - Posts: 52
Thanks so much!

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

Login

Login Page - Create Account