Hi,
How can I create alerts from each condition in group in the same strategy run? Please help me with a code.
Can I improve PC performance running 1 strategy with 2 conditions instead of 2 strategies with 1 condition in each?
Thank you.
Size:
Color:
Of course it's more convenient to code 2 conditions and run a single strategy. You can create a single strategy with any number of conditions (even hundreds or more).
QUOTE:
How can I create alerts from each condition in group in the same strategy run?
To me it sounds like you just need to learn how to use the OR divider (you probably don't need a MC group). Anyway, this question isn't clear to me in the context of a multi-condition group. Please provide a specific example of what you want to do.
Size:
Color:
In MC group I have 2 conditions:
- Stoch K cross D and
- Stoch K TurnUp
Can I have 2 alerts if both conditions met in same bar in monitor.
About performance. 2 strategies with 1 condition each update same dataset each run in monitor. 1 strategy with 2 condition update same dataset just once. Will it save PC resources?
Size:
Color:
For logical AND just stack the conditions as you have written. You do not need an MC group.
Re: performance
Conditions cost next to nothing. An extra strategy is a new thread, duplicate Bars objects in memory, etc. Anyway, there's really no way to get the same result by running two strategies if you need to logically combine conditions between them.
Size:
Color:
How can I buy on each condition in MC. Thank you.
CODE:
Please log in to see this code.
Size:
Color:
I mean can I have in monitor 2 alerts on 2 conditions if both conditions met during MC look-back period. Thanks again
Size:
Color:
QUOTE:
I mean can I have in monitor 2 alerts on 2 conditions if both conditions met during MC look-back period.
I agree with Cone, and this idea of two alerts on what effectively is the same condition doesn't make sense to me.
P.S. On a related note, just wanted to make sure you're aware of this live bug in the StochD indicator:
(55091) Calculating StochD gets slower in geometric progression depending on smoothingYour code does not contain strategy parameters and/or long-period StochD, but just to be on the safe side as you showed some speed/performance concerns.
Size:
Color:
QUOTE:
can I have in monitor 2 alerts on 2 conditions
This is different than what you wrote in your MC Grouping, but since you're asking for multiple alerts, the strategy must handle
multiple Positions.
To do that:
1. select "Multiple open Positions allowed" at the bottom right of the Strategy Builder
2. put an OR divider (top of the Condition list) between the conditions.
You don't need the MC group, but you could use it like an OR if you set both parameters to 1. However, the resulting code is much less efficient for that purpose.
Size:
Color:
Thank you both very much.
Actually I use 3 strategy each using 1 indicator and 2 conditions: Stoch, CMF and MACD.
How code should look if I use MC with look-back e.g.3 and expect both alerts from MC group during this look-back period.
Can I have alert name for each of 2 condition in MC group.
Size:
Color:
QUOTE:
1 indicator and 2 conditions: Stoch, CMF and MACD.
I'm counting 3 indicators here.
QUOTE:
How code should look if I use MC with look-back e.g.3
What's your concern about how the "code should look" if your designing your strategy in the Strategy Builder?
QUOTE:
expect both alerts from MC group during this look-back period.
Let's say you have 2 conditions and want both of them to have been true at least once in the lookback period. You need to set "Required Conditions" to 2.
QUOTE:
Can I have alert name for each of 2 condition in MC group.
You cannot.if using the Strategy Builder code. However, by coding manually you have an infinite amount of flexibility to do anything you'd like.
Size:
Color: