Signal confirmation before Algo starts
Forums › ProRealTime English forum › ProOrder support › Signal confirmation before Algo starts
- This topic has 10 replies, 4 voices, and was last updated 3 years ago by
idunnomuch.
-
-
12/17/2021 at 5:38 PM #183514
I have a trading algo I have created. Seems to be working well for what I want.
The issue is when you start it it immediately read as signal and goes into a trade – which is problematic.
Obviously once it is in a trade and up and running it can do its own thing and is fine. The issue is always with its first step.
Is there a way to programme it so that it waits for a signal before starting the algo and then never refers back to that again?
i.e.
indicator1 = DIplus[14]
indicator2 = DIminus[14](close)
c1 = (indicator1 CROSSES OVER indicator2)Once this happens then the algo will start?
Thanks
12/17/2021 at 8:38 PM #183521When you have started your algo, the first trade will depend on the conditions you have set in your algo.
The condition, in your example, will indeed ensure that, when the condition is met, the first trade will be executed.
There is nothing wrong with the condition in your example.
12/17/2021 at 8:43 PM #183522Try adding this line at the very beginning:
1Defparam PreLoadBars = 012/18/2021 at 9:39 PM #183576Thanks, but not quite what I was trying to explain. Sorry for my poor explanation.
I shall try and explain it better.
Basically I would like to get the algo to find a setup first, once it does this then execute a follow on strategy and once it is done, do nothing until the setup presents itself again.
For instance.
Once MACD line crosses signal – it will then wait for SMA 5 to be 3 points higher than SMA 8 before executing a buy signal.
But after trade is executed and ended it should wait until the MACD line crosses the signal line before relooking for the setup.
Does this make sense?
IT is almost like when this is triggered wait for this condition and end. Wait for trigger again and then wait for condition.
As the conditions never happen simultaneously and I want a cross over condition rather than a > condition.
Thanks
12/18/2021 at 10:40 PM #183577If I understand what you mean, then you must work with “conditions”:
For example:
MyCondition = 0
If MACD Crosses Over …. Then
MyCondition = 1
EndIf
If Average[5](close) > Average[8](close) + 3 AND MyCondition = 1 then
Buy x contract at market
EndIf
12/18/2021 at 11:08 PM #18357812/19/2021 at 4:32 PM #183601Thank you MYCondition is very useful.
So as I understand it then – once MYCONDITION is fulfilled it will allow the other conditions “Average[5](close) > Average[8](close)” to trigger an action.
Thanks for your help.
12/19/2021 at 8:37 PM #183605That’s right, when MyCondition (or the name you want to give it) is triggered, it can, together with the next condition, generate a buy or sell signal.
Please note that you put MyCondition back to zero after closing a trade by, for example,
If OnMarket = 0 and OnMarket[1] = 1 then
MyCondition = 0
EndIf
You can of course use more conditions for Long and Short, but that works in an equal way.
12/20/2021 at 6:40 PM #183651Thanks – but I don’t think it does what I need.
All it is doing to setting a trigger point with a condition.
If Average[5](close) > Average[8](close) + 3 AND MyCondition = 1 then
i.e. in this scenario all it needs to happen is the SMA 5 needs to be greater then the SMA8 and at the same time the MACD needs to have crossed over?
What I want is a scenario where once the MACD crosses over it enables the trade to happen once the following parameters are satisfied.
I don’t want them to need for them to happen all at the same time before it triggers the action.
Does that makes sense?
12/20/2021 at 7:56 PM #183655If JS had called MyCondition a Flag then it may have been easier to grasp the concept?
Flag = 0 at start of code, if MACD crosses over then Flag =1; Flag stays at 1 forever until code resets to Flag = 0 (e.g. at trade exit).
So Flag = 1 could be for 50 bars until Average[5](close) > Average[8](close) + 3.
Hope that helps?
12/21/2021 at 2:08 PM #183691 -
AuthorPosts
Find exclusive trading pro-tools on