THEN condition to use it as an IF condition in the second rule
15件の返信
こんにちは,
someone knows how to process the result of a rule #1 in a second rule?
例えば:
In the first rule i use です the condition MACD > 0 if the result is true i want to use this signal in the second rule.
I try it with THEN Assign Variable, but this variable remains even if the IF conditions no longer be met.
セザール
0
Czar,
You are correct, the rule will asign the variable and then not touch the variable again until the conditions are met.
So what you need to do is have 2 rules: 1st rules assigns variable when MACD >0 and then 2nd rule which assigns variable when MACD<0. Then your variable will always be a reflection of where the MACD is.
ステアノ
0
Hi Stearno,
I was afraid that it is the only way. その above condition was just a simplified example, the condition is quite complicated そして condition for the reverse is very complicated and I thought it can somehow solve different.
I’ve got another idea. I Just try to export the condition as an indicator and then import it into the wizard in order to use the sigal.
セザール
0
こんにちは,
someone knows how to process the result of a rule #1 in a second rule?
例えば:
In the first rule i use is the condition MACD > 0 if the result is true i want to use this signal in the second rule.
I try it with THEN Assign Variable, but this variable remains even if the IF conditions no longer be met.
Hello Cezar,
what you can do is process the result on the second rule, and then set the variable to false again (by Assign variable function).
マーク
マーク
StrategyQuantアーキテクト
0
こんにちは、マーク,
I do not quite understand. Can you give me a concrete example of this function?
セザール
0
I meant something like this:
ルール1:
IF Market Position Is Flat and MACD > 0
それから
Assign Variable ThereIsSignal = 1
規則2:
IF ThereIsSignal = 1
それから
Enter At Market
Assign Variable ThereIsSignal = 0
this way the variable that was set by the first rule will be unset when you enter the trade, this was your problem as I undetstood.
マーク
マーク
StrategyQuantアーキテクト
0
ありがとうございます, that is the solution!
セザール
0
I meant something like this:
ルール1:
IF Market Position Is Flat and MACD > 0
それから
Assign Variable ThereIsSignal = 1
規則2:
IF ThereIsSignal = 1
それから
Enter At Market
Assign Variable ThereIsSignal = 0
this way the variable that was set by the first rule will be unset when you enter the trade, this was your problem as I undetstood.
マーク
Hi, I am dealing with similar issue, please help. Anyone.
multi entry if price above 100 ema.
1st entry if 10 ema cross above 20 ema, then enter at market with target.
2nd entry if 10 ema cross above 20 ema again and price still above 100 ema, enter at market. (sometimes 1st may not open anymore if target was reached)
keep enter at market as long as price above 100 ema and very time 10 ema & 20 ema cross above independently.
I tried to assign variable, but My current ea keep open both 1st and 2nd entry at the same time when the 1st entry happens and skip the rest of valid entrys.
ありがとうございます、,
0
Hi, I am dealing with similar issue, please help. Anyone.
multi entry if price above 100 ema.
1st entry if 10 ema cross above 20 ema, then enter at market with target.
2nd entry if 10 ema cross above 20 ema again and price still above 100 ema, enter at market. (sometimes 1st may not open anymore if target was reached)
keep enter at market as long as price above 100 ema and very time 10 ema & 20 ema cross above independently.
I tried to assign variable, but My current ea keep open both 1st and 2nd entry at the same time when the 1st entry happens and skip the rest of valid entrys.
ありがとうございます、,
Hello 518pip,
I think you don´t need to assign a variable.
Rule 1: The first entry –> IsBarOpen is True && Bid > EMA 100 && EMA 10 cross above EMA 20
Rule 2 The second entry –> IsBarOpen is True && (Open P/L [Magic_first_entry] 0 or Closed P/L [Magic_first_entry] 0) && Bid > EMA 100 && EMA 10 cross above EMA 20
To close you can use a third rule with the close conditions.
Hope I could help you. Otherwise you can attach sthe trategy to the post then we can help you more specifically.
セザール
0
Hi, I am dealing with similar issue, please help. Anyone.
multi entry if price above 100 ema.
1st entry if 10 ema cross above 20 ema, then enter at market with target.
2nd entry if 10 ema cross above 20 ema again and price still above 100 ema, enter at market. (sometimes 1st may not open anymore if target was reached)
keep enter at market as long as price above 100 ema and very time 10 ema & 20 ema cross above independently.
I tried to assign variable, but My current ea keep open both 1st and 2nd entry at the same time when the 1st entry happens and skip the rest of valid entrys.
ありがとうございます、,
You can do it like this (I’ll show only the long side):
——————–
ルール1:
——————–
もし
OrderPosition(1000) is not Flat // we make sure the first order is opened already
and Bid > EMA(100) // make sure that price is above EMA(100)
and EMA(10) crosses above EMA(20)
それから
Enter at Market with Magic Number(2000)
——————–
規則2:
——————–
もし
OrderPosition(1000) is Flat // we make sure the order isn’t opened already
and Bid > EMA(100) // make sure that price is above EMA(100)
and EMA(10) crosses above EMA(20)
それから
Enter at Market with Magic Number(1000)
This should work. The second rule takes care of taking any signal when EMA(10) crosses EMA(20) and Rule 1 takes care of special case that the first order is already opened.
The rules have to be in this order.
Perhaps you’d have to add also Is Bar Open = true to both rules to make sure the trades are opened only on bar open.
マーク
StrategyQuantアーキテクト
0
皆様、こんにちは,
I have a similar question, in line with the subject of this thread.
I keep getting new positions opened, with every new tick.
What I want to do is only open a position once, if my conditions are met.
If there is already an open position, do not open another one.
If a position has been closed, then it is OK to open another position if conditions are met.
My code is like this.
——————–
ルール1:
——————–
IF IsBarOpen is True
and Some Other Condition //too long to repeat here, but doesn’t matter
and OrderPosition(MagicLong) is Flat //ie: there is no open positions ??? (is that right?)
THEN Enter at Market (MagicLong)
As I understand it, you can only open one position per magic number, yet it keeps opening new positions every tick.
Any suggestions,
ありがとう。.
0
こんにちは、,
condition OrderPosition(MagicLong) is Flat really is true if there are no open positions, so your conditions are correct.
As I understand it, you can only open one position per magic number, yet it keeps opening new positions every tick.
yes,it shouldn’t open multiple positions with the same magic number. If it opens new position every tick there is some problem or possible bug. Can you post your strategy (.sqw file) here?
マーク
StrategyQuantアーキテクト
0
Hi , I want to create a condition that first checks for the first rule to then continues to the next one
Say :
If MA 1 crosses over MA 2 under BB LowerBand.
How do I implement something like this ?
0
こんにちは、,
you can simply do multiple condition lines. They need to happen at the same bar. See the image
0
15件の返信を表示中 - 1 - 15件目 (全15件中)