SL control

9 replies

TJ#

Customer, bbp_participant, community, 144 replies.

Visit profile

8 years ago #114378

I would like to create a hidden SL control such that when I long the position, if it loses more than 25 pips, it will close the position and If I short the position, if it loses more than 35 pips it will close the position. 
 
 
I have created a EA but it does not seem to work as what planned. Are you able to help on this? Thank you. 

0

TJ#

Customer, bbp_participant, community, 144 replies.

Visit profile

8 years ago #133714

These did not work either…

 

bid cross below abc level ==> close position (100)

or 

ask cross above xyz level ==> close position (200)

 

 

How to get this right? 

0

tomas262

Administrator, sq-ultimate, 2 replies.

Visit profile

8 years ago #133720

Hi,

 

it seems Open P/L (pips) function always return 0 for me. That could be a reason why conditions don’t work. I will test this where the problem could be and let you know

0

tomas262

Administrator, sq-ultimate, 2 replies.

Visit profile

8 years ago #133749

Hello,

 

I have created an example on how to exit a position when open PL (pips) exceeds certain (negative) limit in pips. Tested and works well. To be sure it works correctly I also added print to MT journal

0

TJ#

Customer, bbp_participant, community, 144 replies.

Visit profile

8 years ago #133775

hi,

 

I realised that we somehow cannot put both BUY & SELL’s conditions & both control stops on the same EA to work.  It has to be BUY (Long Only) & control stop, one EA and SELL (Short Only) & control stop, the other EA. Very interesting… 🙁

 

2nd, I cannot get it to work with specific levels, 

bid cross below abc level ==> close position (100)

or 

ask cross above xyz level ==> close position (200)

 

Worst nightmare

The 3rd issue is, this EA works only on Oanda’s Demo account and not on Oanda’s Live account. I don’t know why… 

 

Both are running same version & build “400 Build 890”. 🙁

 

Ps.

I have removed the Long trigger conditions… you can insert any of yours.. 

0

tomas262

Administrator, sq-ultimate, 2 replies.

Visit profile

8 years ago #133797

Ok, will look at that

What issue is that with Oanda live? EA not opening trades? Is there any error message in MetaTrader log?

0

TJ#

Customer, bbp_participant, community, 144 replies.

Visit profile

8 years ago #133798

in the Demo acc, the EA is closing the trade as expected or planned (perfect!!), but when put it in the Live acc, it became a “rogue” EA. it does not close the trade when the losing pips were reached or exceeded.

 

It just ignores the EA rules totally.. 🙁

 

How do I see the MT logs? where to find them? 

0

TJ#

Customer, bbp_participant, community, 144 replies.

Visit profile

8 years ago #133827

When I was testing this out:

1.  AUDUSD’â„¢s spread was @ 1.6 pip

2.  I used a test script to trigger the BUY

3.  My hidden SL was set to -5.0 pips ==> when SL is greater than -5 pips trade will be closed.

a.  The Hidden Stop Loss(in pips) is set as a var(double) so that I can change it as and when I see fit.

 

 

2      05:47:39.976  Script Long AUDUSD,M15: loaded successfully

0      05:47:40.245  ‘233753’: order buy market 0.01 AUDUSD sl: 0.00000 tp: 0.00000

0      05:47:40.543  ‘233753’: order was opened : #71026184 buy 0.01 AUDUSD at 0.71456 sl: 0.00000 tp: 0.00000

0      05:47:40.543  ‘233753’: modify order #71026184 buy 0.01 AUDUSD at 0.71456 sl: 0.00000 tp: 0.00000 -> sl: 0.70928 tp: 0.00000

0      05:47:40.824  ‘233753’: order #71026184 buy 0.01 AUDUSD at 0.71456 was modified -> sl: 0.70928 tp: 0.00000

2      05:47:40.825  Script Long_09 AUDUSD,M15: removed

 

2      05:48:19.296  Expert Hidden_SL_Long AUDUSD,M15: loaded successfully

0      05:48:59.099  ‘233753’: modify order #71026184 buy 0.01 AUDUSD at 0.71456 sl: 0.70928 tp: 0.00000 -> sl: 0.71261 tp: 0.00000

0      05:48:59.387  ‘233753’: order #71026184 buy 0.01 AUDUSD at 0.71456 was modified -> sl: 0.71261 tp: 0.00000

1      05:50:14.340  ‘233753’: modification of order #71026184 buy 0.01 AUDUSD at 0.71456 sl: 0.71261 tp: 0.00000 -> sl: 0.71478 tp: 0.00000 failed [Invalid S/L or T/P]

 

Hopes the info provided is useful to you. 🙂

0

TJ#

Customer, bbp_participant, community, 144 replies.

Visit profile

8 years ago #133833

the following log data is from Oanda Demo account..

 

Same setup as Live account, 

 

2 06:39:23.977 Script Long GBPJPY,M1: loaded successfully
0 06:39:24.001 ‘9293157’: order buy market 0.01 GBPJPY sl: 0.000 tp: 0.000
0 06:39:24.312 ‘9293157’: order was opened : #186462498 buy 0.01 GBPJPY at 186.439 sl: 0.000 tp: 0.000
0 06:39:24.312 ‘9293157’: modify order #186462498 buy 0.01 GBPJPY at 186.439 sl: 0.000 tp: 0.000 -> sl: 185.851 tp: 0.000
0 06:39:24.594 ‘9293157’: order #186462498 buy 0.01 GBPJPY at 186.439 was modified -> sl: 185.851 tp: 0.000
2 06:39:25.356 Script Long GBPJPY,M1: removed
2 06:39:31.337 Expert Hidden_SL_Long GBPJPY,M1: loaded successfully
0 06:42:14.408 ‘9293157’: close order #186462498 buy 0.01 GBPJPY at 186.439 sl: 185.851 tp: 0.000 at price 0.000
0 06:42:14.687 ‘9293157’: order #186462498 buy 0.01 GBPJPY at 186.439 sl: 185.851 tp: 0.000 closed at price 186.388

0

tomas262

Administrator, sq-ultimate, 2 replies.

Visit profile

8 years ago #133906

TJ, have you talked to Oanda about differences between live and demo account? There can be and they could help solve this too

0

Viewing 9 replies - 1 through 9 (of 9 total)