Breakeven with a technical indicator
- This topic has 5 replies, 3 voices, and was last updated 4 years ago by .
Viewing 6 posts - 1 through 6 (of 6 total)
Viewing 6 posts - 1 through 6 (of 6 total)
Similar topics:
Forums › ProRealTime English forum › ProOrder support › Breakeven with a technical indicator
Hello,
Is it possible to put the SL in Breakeven when it reaches a technical indicator?
Example :
– I buy when the price bounces on the lower bollinger band
– I place my SL under the most recent low
– I target as TP the upper bollinger band
Is it possible to move the SL to breakeven when the price reaches the SMA20?
You can place orders to sell at any price using pending STOP and LIMIT orders. So just check if your SMA condition has been met and then set a flag and send a pending order to sell at TRADEPRICE for every bar while the flag is true. Reset the flag once NOT ONMARKET.
Hello @vonasi, thank you, I tried to put a flag for the condition (close>=SMA20 ), in order to move the SL to breakeven.
But I think there’s a mistake in my coding.
Can you help me?
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
// BUY if ConditionsPurchase AND Not OnMarket then BUY 1 lot AT market endif // BREAKEVEN SMA20 = Average [20](close) once flag = (close >= SMA20) if OnMarket AND flag =1 then SELL 1 lot AT TRADEPRICE +1 LIMIT endif // TP = HIGH BOLLINGER BBH = BollingerUp [20](close) C3 = (high >= BBH) MyConditionsCloture = C3 if MyConditionsCloture AND OnMarket then SELL 1 lot AT market endif |
The “once” in line 8 is wrong. This calculation is done once at the start, not on every candle. Just remove it.
LIMIT sells at a better price than the current close whereas STOP sells at an inferior price than the current close so you are using the wrong instruction.
Also as said before ONCE is not neeeded.
@ thank you very much 🙂
Find exclusive trading pro-tools on