Viewing 9 posts - 1 through 9 (of 9 total)
• #111624 |
Participant
18 Posts

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?

#122727
1182 Posts

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

#122732
Participant
18 Posts

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.

#122735
Participant
18 Posts

Boolean variables can only be used as a condition, I just found out. So I have to use an integer variable.

#122739
1182 Posts

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

#122740
Participant
18 Posts

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.

#122749
1182 Posts

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

#122760
Participant
18 Posts

Just to make sure of some definition. Rule 1 is the first rule of the EA.

Rule 1:

IF Market Condition is Flat

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?

#122801
1182 Posts

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 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.