Reply

How to tell the EA to use price value to offset the movement.

4 replies

Count-Roy

Subscriber, bbp_participant, community, 69 replies.

Visit profile

6 years ago #113709

so, what I would like to do is say

 

first rule get price.

 

second rule

 

if price has moved (x number) pips

 

then

place / close multiple orders and thus different multiple magic numbers

0

tomas262

Administrator, sq-ultimate, 684 replies.

Visit profile

6 years ago #130452

What’s the first condition? When you need to get that ‘price!? 9 o’clock or after MA cross or …? You need to specify

 

1) Basically you can create variable like “LastPrice” and set it to 0

2) When first condition is true then you set this variable (action ‘Assign Variable’) to Close price for example

3) Then you create second rule where you subtract (using Subtraction() function) current Close and the price stored in “LastPrice” to get difference and you compare it (,=) to some fix value

4) If previous is true you can do some order management mentioned

0

Count-Roy

Subscriber, bbp_participant, community, 69 replies.

Visit profile

6 years ago #130454

rule one

 

get time, would be the moment you turn on the EA.

 

then enter market.

 

rule two:

 

if price has move (x) pips\

 

than

open / close

 

 

How would I do that?

 

thanks for the extremely quick reply 🙂

0

tomas262

Administrator, sq-ultimate, 684 replies.

Visit profile

6 years ago #130519

Hello,

 

I tried to make an example for you:

 

1) if you run and there is no position, strategy enters immediately long and stores current time and current price

2) second rule says if position is not flat and difference between current close price and execution price is higher than X pips defined it closes long position

 

Hope that helps.

0

Count-Roy

Subscriber, bbp_participant, community, 69 replies.

Visit profile

6 years ago #130601

First off, thank you for sharing that. nice way of writing 🙂 definitely not something I would of thought of myself.

 

so what I have added to it, is on the enter market rule a short position as well. and removed the profit target / stop loss values.

 

then moving to exit market rule.
here I am stuck, because as we exit one order that has moved x pips in profit we which to re-enter with two orders, one long and one short.  

 

this we then wish to continue as the market moves up and down.  

 

in essence a grid would be established.

 

so what I have done is added a rule and added thens in the two rules you already have made.

 

as you can see, assigning magic numbers becomes quickly confusing. so what would be nice is a variable that automatically assigns magic numbers. 

 

well, I hope I am making sense and thanks again for helping.  

0

Viewing 5 posts - 1 through 5 (of 5 total)