Always use the ‘Insert PRT Code’ button when putting code in your posts, not when writing TEXT.
- Lets start by the beginning.
I agree with this
- Can you have several positions with different stop and profit for each position?
No, you can accumulate more than one position, but there is only one SL and only one TP
- How to program that the first position enters with conditions, stop 1.5% and profit 3%, and places breakeven when it gains 0.5%, and then, when the first position places breakeven, that the second position enters without conditions and without affecting to the breakeven of the first position. For the second position the stop would be 2% and the profit 2.5%. There could be a third position, when the second position rises 0.5% and breakeven, its stop would be 2.5% and its profit 2%.
It can’t be done due to my answer to point 2.
OK Roberto, thanks for your answer …
So I understand that several positions add up to a single position.
Which brings me inevitably to the next question.
If there is only one position, the stop would be 1.5% and 3% profit and its breakeven would be placed when it gains 0.5%.
If another position enters, stop, profit and breakeven are canceled … but I understand that the stop could be 3%, profit 6% and the breakeven would be placed when it gains 1%.
And if a third position enters, all of the above would be canceled, and we could put a 4.5% stop, 9% profit, and 1.5% to place the breakeven.
In this way we could have similar conditions, regardless of how many positions there are, despite the circumstances
Can this be done ??? … or something like that ???
Please!!!
When you add a position the tradeprice becomes POSITIONPRICE, which is an average of all entry prices multiplied by the number of lots.
Do the SL & TP are updated accordingly.
Percentages will reamain the same, just calculated on a different average price. https://www.prorealcode.com/documentation/positionprice/
OKAY.
I have elaborated all this code but there is something that escapes me.
Up to € 21,000 of strategyprofit there can only be one position and up to € 10 of position.
Between € 21,000 and € 28,000 of stategyprofit there may be one or two positions, both of € 10 each … that is, € 20 maximum total position.
More than 28000 of strategy profit there can be one, two, or three positions, of € 10 each … that is, € 30 maximum total position.
//Tamaño, Profit y Stop de la posicion
IF CONDBUY and Strategyprofit <= 21000 and count<maxorders1 THEN
ONCE Positionsize = 0.5
buy positionsize contract at market
SET TARGET %PROFIT 2.1
SET STOP %LOSS 1.5
ENDIF
IF CONDBUY and Strategyprofit >= 21000 and Strategyprofit <= 28000 and count<maxorders1 THEN
ONCE Positionsize = 10
buy positionsize contract at market
SET TARGET %PROFIT 2.1
SET STOP %LOSS 1.5
ENDIF
IF CONDBUY and Strategyprofit >= 21000 and Strategyprofit <= 28000 and count<maxorders2 THEN
ONCE Positionsize = 10
buy positionsize contract at market
SET TARGET %PROFIT 4.2
SET STOP %LOSS 3
ENDIF
IF CONDBUY and Strategyprofit >= 28000 and count<maxorders1 THEN
ONCE Positionsize = 10
buy positionsize contract at market
SET TARGET %PROFIT 2.1
SET STOP %LOSS 1.5
ENDIF
IF CONDBUY and Strategyprofit >= 28000 and count<maxorders2 THEN
ONCE Positionsize = 10
buy positionsize contract at market
SET TARGET %PROFIT 4.2
SET STOP %LOSS 3
ENDIF
IF CONDBUY and Strategyprofit >= 28000 and count<maxorders3 THEN
ONCE Positionsize = 10
buy positionsize contract at market
SET TARGET %PROFIT 6.3
SET STOP %LOSS 4.5
ENDIF
<span class="tlid-translation translation" lang="en"><span class="" title="">There is a first part that does it well, but then, as seen in the photos, it buys positions of € 20 and € 30, but they should all be € 10</span></span>
ONCE means ONLY ONE TIME, so they will only be read ONCE on the very first bar.
Remove the word ONCE.
Fran55 – Please be more careful/tidy when posting. Do not include your questions/comments within the inserted code. I have tidied up your post for you.
Ok, sorry.
I quit “ONCE”, but the problem persist.
We need:
- to know what is the issue you are talking about
- full code
because part of the code you post rely on other parts.
I just want all the operations to be € 10.
In the photos you can see that there are operations € 20 and € 30.
If you want all operations to be 10, just use only one SL and TP set with 10 pips, instead of a percentage.