Moving TP & SL

18 replies

CTC

Subscriber, bbp_participant, community, 14 replies.

Visit profile

8 years ago #113786

Hi, 

I am trying to do this:

if OpenProfit(magicBuy) > Variable1 then

 Move SL to  CurrentPrice – Variable1 and

 MoveTP to min(currentPrice+TP + Variable2,CurrentPrice+MaxTP) (ie. if maxTp is reached  I close the order)

.

 How is this accomplished?

 

I attach a sample SQW for your consideration…

 

Please consider that MagicNumbers are variables as the EA could run on different Pairs.

 

Thanks a lot,

 

Claudius

0

tomas262

Administrator, sq-ultimate, 2 replies.

Visit profile

8 years ago #130837

Hi,

 

if you just want to move SL when OP (Variable1) reaches certain amount of money/pips I would use MoveToBreakEven function for the entry order since your condition actually moves it to break-even.

Bit confused about variable you use for profit-target. How is ‘Variable2’ used and calculated? I cannot see it in your sample. Can you verbally describe behavior of the profit-target so I can suggest rules for that?

0

CTC

Subscriber, bbp_participant, community, 14 replies.

Visit profile

8 years ago #130887

I thought could be easier to explain it graphically… Please have a look at the attached  sketch.

 

Thanks,

0

tomas262

Administrator, sq-ultimate, 2 replies.

Visit profile

8 years ago #130949

Hi,

 

I am still not sure if I get right so:

1) you enter to a long position and set the Initial PT + Initial SL

2) when price moves X pips you move SL to a new price

3) you also move PT to a new price

 

Now I am not sure what this means ‘Close order if initial TP reaches max TP’? Can you give me real life example using some abstract prices? How can Init PT reach Max PT? Are Max PT & Init PT fix values?

0

CTC

Subscriber, bbp_participant, community, 14 replies.

Visit profile

8 years ago #130961

Thanks for the reply.

Exactly!! Both SL and initialTP move with the price movement.

Initial Take Profit is set ,say, to 70 pips and maxTP to 200 pips.

As we move InitialTP to a new price, if it reaches the maxTP (200 pips) the order is closed.

I hope this is clear!

 

Thanks,

0

tomas262

Administrator, sq-ultimate, 2 replies.

Visit profile

8 years ago #131054

hi,

 

created a strategy example for you which does following:

 

1) enters into a long position and sets SL to 40 pips and PT to 40 pips

2) when position gets into profit > 0, trailing SL is being activated so with each additional pips of profit (x), your SL is moved higher by X pips so new SL is always kept 40 pips from max open profit price and max loss is limited then to 40 pips

3) with each additional pip into profit, your initial PT is also moved to a higher price

4) when PT moving higher reaches max PT (in this case 80 pips), position is closed

 

Is this what you wanted?

0

CTC

Subscriber, bbp_participant, community, 14 replies.

Visit profile

8 years ago #131141

Thanks,

 

We are heading in the right direction!!!

 

The only problem I cannot clone your strategy with different MagicNumber – MagicNoSell….

 

Could you please have look?

 

Thanks,

 

0

tomas262

Administrator, sq-ultimate, 2 replies.

Visit profile

8 years ago #131150

Hi,

 

I added and tweaked conditions for short side too. Look at file attached.

0

CTC

Subscriber, bbp_participant, community, 14 replies.

Visit profile

8 years ago #131164

Thanks,

 

Tried to use the file you attached, but it cannot be saved as Expert Advisor, giving a lot of error exceptions… 

 

Please see attached .

 

Thanks

0

CTC

Subscriber, bbp_participant, community, 14 replies.

Visit profile

8 years ago #131188

Thanks !!

 

 It seems I needed the update to get it correct!

 

Thanks.again.

0

CTC

Subscriber, bbp_participant, community, 14 replies.

Visit profile

8 years ago #131355

Hi,

 

I tried to clone your “Adjust PT – Buy” Rule to a new “Adjust SL – Buy” by:

 MoveSLTo:

 Magic Nuber : MagicNoBuy

 Price : openPrice(MagicNoBuy) + ConvertPLToRealPips(OpenPL(MagicNoBuy))))

On entering the last line I always get “Property Value is not valid” error….

 

(MovePT is left there so that I can copy what I want …!)

 

What do I do wrong ????

 

Please see attached..

 

Thanks,

 

 

 

 

 

0

tomas262

Administrator, sq-ultimate, 2 replies.

Visit profile

8 years ago #131484

Is this what you wanted?

 

 

0

CTC

Subscriber, bbp_participant, community, 14 replies.

Visit profile

8 years ago #131506

Yes, Thanks.

 

Just tried to clone this for “Adjust SL- Sell” but could not change MagixNoBuy to MagicNoSell, neither change addition to subtraction ….

 

Also tried to enter conditions for Close Order For StopLoss (Current PRice Falls below NewSLPrice) for both Buy and Sell, but the program did not accept my formulas… For example when I try to change MagicNoBuy to MagicNoSell, I can only change magicNo from 1000 to 1001 + or 999 -… What am I doing wrong with formula entry?

 

Thanks,

0

tomas262

Administrator, sq-ultimate, 2 replies.

Visit profile

8 years ago #131556

hi, will check the file you attached

0

tomas262

Administrator, sq-ultimate, 2 replies.

Visit profile

8 years ago #131616

You can change MagicBuy to MagicSell easily. You have to just “double-click” through conditions since they are nested into each other. For example in Adjust SL – SELL double click on NewSLPrice then on “Value” line click on “…”, then click again on “…” on the Parameter1 line where you can change the magic number. Then you can do the same for Parameter2.

 

Can you somehow post a screenshot of how you compose the formula?

0

CTC

Subscriber, bbp_participant, community, 14 replies.

Visit profile

8 years ago #131626

A screenshot is attached. 

 

PLEASE HELP !!!!

 

0

Viewing 15 replies - 1 through 15 (of 18 total)

1 2