Restart of EA
8 replies
chengsmine
10 years ago #111624
Suppose I have an initial Rule, such as:
IF Market Conditiion is Flat
or Last Order was Flat
Assign Variable PU
Value: Open (0) + ConvertToRealPips(DS)
where DS is an integer.
After many rules, if I want the EA to return to the above rule and run the strategy again, is Last Order was Flat a good condition to enable the EA to restart? Or Is there a better condition to restart an EA?
Mark Fric
10 years ago #122727
no, ‘Last Order was Flat’ is not a good condition, last order cannot be Flat, it can be only Long or Short.
Flat means that the order is not placed, and because there is some last order it was obviously placed.
You can use some variable to restart an EA.
For example create a variable StartEA, and use condition StartEA = true in your first rule, then set StartEA = false in the action.
Then in some rule where you’d want to restart the EA you’ll set StartEA= true.
For exmaple:
Rule 1:
IF (CCI > 0 and StartEA = true)
THEN
Open Order
StartEA = false
Rule 2:
…
Rule 3:
…
Restarting rule:
IF(something)
THEN StartEA = true
I hope you understand what I mean.
Mark
Mark
StrategyQuant architect
chengsmine
10 years ago #122732
So the EA can remember the value of StartEA before it restarts? I thought you told me in the other post that it will forget all values stored in memory and revert to the default values.
chengsmine
10 years ago #122735
Boolean variables can only be used as a condition, I just found out. So I have to use an integer variable.
Mark Fric
10 years ago #122739
no, EA will not remember any values between the restarts.
My example was about setting the variable at the first tab and then use it in next tabs.
Mark
Mark
StrategyQuant architect
chengsmine
10 years ago #122740
So what you mention:
Restarting rule:
IF(something)
THEN StartEA = true
has no meaning once I restart the EA. If the default value of StartEA is true, it will automatically revert to the default value once I restart the EA.
Mark Fric
10 years ago #122749
yes, you cannot keep state and values of variables when you restart the EA, everything will be reseted to default values.
I thought your question was about the logic of restarting some process within the EA, while the EA is continuously running.
Mark
Mark
StrategyQuant architect
chengsmine
10 years ago #122760
Just to make sure of some definition. Rule 1 is the first rule of the EA.
Rule 1:
IF Market Condition is Flat
THEN Open buy order
After many rules…..
IF (something)
THEN Close all orders
If I return to Rule 1 now, I am restarting the EA, and previous values of parameters are erased, Am I correct?
Mark Fric
10 years ago #122801
no by restarting the EA I mean that you’ll switch it off or remove it from the chart and then you’ll switch it on again.
If you want to erase the parameters you can do so in the last rule:
IF(something)
THEN Close all orders
assign variable X1 = 0
assign variable X2 = 0
etc.
EA Wizard gives you the flexibility to do whatever you want with your variables.
Mark
Mark
StrategyQuant architect
Viewing 8 replies - 1 through 8 (of 8 total)