## Stinger66 Strategy

Strategies are published here.

### Stinger66 Strategy

Based on request.
viewtopic.php?f=27&p=139826#p139826
Stinger66 Strategy.lua

Apprentice
FXCodeBase: Confirmed User

Posts: 28491
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

### Re: Stinger66 Strategy

Hi Apprentice,
Thanks for quick reply and looking ok as it is closing the positions in profit at close of bar.
I am using D1 time period and have another strategy that opens trades.
What I am not seeing is the partial closing of positions in loss when the profit trade is closed.
Is this possible and not sure if you understood my original request?

What I am trying to achieve is, if there is more that one position open in the same direction, that the profitable positions are always closed but the losing positions in the same direction are partially closed by the profit amount achieved.
Logic is only for the same direction of positions.

Example.
1. Position 1 is long 100 with a loss of -\$1000
2. Position 2 is long 100 with a profit of \$500

Position 2 is closed for a profit for \$500
Position 1 is partially closed for 50 Units and loss of -\$500 and 50 units remains open at at a loss of -\$500.

Let me know if this is possible?

Stinger66

Posts: 3
Joined: Thu Dec 10, 2020 1:43 am

### Re: Stinger66 Strategy

Development reference 17.

Apprentice
FXCodeBase: Confirmed User

Posts: 28491
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

### Re: Stinger66 Strategy

Stinger66 Strategy.lua

Try this version.

Apprentice
FXCodeBase: Confirmed User

Posts: 28491
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia

### Re: Stinger66 Strategy

Hello,

Strategy is not closing trades as per my request.
I am looking for immediate partial or full close of trades in loss for the opposite amount of the trade in profit that is closed.
The trades in loss that are closed should always be the oldest trades first.

If this can be achieved then I would like to see if this strategy could be converted to an indicator so that this indicator can be accessed from any strategy,.

What I am trying to achieve is, if there is more than one position open in the same direction, that the profitable positions are always closed but the losing positions in the same direction are always partially closed by the profit amount achieved.
Logic is only for the same direction of positions.

Example.
1. Position 1 is long 100 with a loss of -\$1000
2. Position 2 is long 100 with a profit of \$500

Position 2 is closed for a profit for \$500
Position 1 is partially closed for 50 Units and loss of -\$500 and 50 units remains open at at a loss of -\$500.

Frank,
Stinger66

Posts: 3
Joined: Thu Dec 10, 2020 1:43 am

### Re: Stinger66 Strategy

Development reference 102.

Apprentice
FXCodeBase: Confirmed User

Posts: 28491
Joined: Thu Dec 31, 2009 11:59 am
Location: Zagreb, Croatia