PROGRAMACION STOP LOSS – AYUDA
- This topic has 5 replies, 2 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 foro Español › Soporte plateforma ProRealTime › PROGRAMACION STOP LOSS – AYUDA
Tagged: trailing stop
HOLA. QUIERO PROGRAMAR EL STOP LOSS DE UN SISTEMA, QUIERO QUE EL STOP LOSS INICIAL ESTE 1% DEBAJO DEL MINIMO DE LAS ULTIMAS 5 VELAS. Y QUE LUEGO DE QUE EL PRECIO DE LA ACCION SUBA UN 10% POR EJ, EL STOP LOSS SE CORRA AL PRECIO DE ENTRADA, Y DESDE AHI APLICAR TRAILING STOP DE X%. ¿ES POSIBLE O NO? MUCHAS GRACIAS!
NO escriba en mayúscula, excepto palabras simples u oraciones muy cortas para señalar algo.
Se considera que las mayúsculas son gritos cuando se habla, según netiquette.
Tiene poca educación y es más difícil de leer. Gracias 🙂
Este es mi código (no probado) para posiciones largas:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
If not OnMarket then NewStop = 0 Endif If not OnMarket then //do not change while at market StopLoss = lowest [5](low) * 0.99 //-1% Endif MyProfit = TradePrice * 1.1 //+10% Result = TradePrice * (1 + PositionPerf) If NewStop > 0 Then MyProfit = NewStop * 1.05 //5% trailing stop If close >= MyProfit Then NewStop= MyProfit Endif Endif If NewStop = 0 and OnMarket and Result >= MyProfit Then NewStop = TradePrice Endif If MyConditions and Not OnMarket then Buy 1 contract at Market Sell at StopLoss STOP Endif If OnMarket then Sell at max(StopLoss,NewStop) STOP Endif |
I edit my code above to correct a couple of errors.
This is a complete MTF version for both Long and Short trades:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
DEFPARAM CumulateOrders = false // timeframe(1 day,updateonclose) CondL = close > average[200] AND average[10] CROSSES OVER average[20] CondS = close < average[200] AND average[10] CROSSES UNDER average[20] // timeframe(default) If not OnMarket then NewStop = 0 Endif If not OnMarket then //do not change while at market StopLossL = lowest [5](low) * 0.99 //-1% StopLossS = highest [5](low) * 1.01 //+1% Endif IF LongOnMarket THEN MyProfit = TradePrice * 1.10 //+10% Result = TradePrice * (1 + PositionPerf) ELSIF ShortOnMarket THEN MyProfit = TradePrice * 0.90 //-10% Result = TradePrice * (1 - PositionPerf) ENDIF If NewStop <> 0 Then IF LongOnMarket THEN MyProfit = NewStop * 1.02 //2% trailing stop If close >= MyProfit Then NewStop= MyProfit Endif ELSIF ShortOnMarket THEN MyProfit = NewStop * 0.98 //2% trailing stop If close <= MyProfit Then NewStop= MyProfit Endif ENDIF Endif If NewStop = 0 THEN IF LongOnMarket and Result >= MyProfit Then NewStop = TradePrice ELSIF ShortOnMarket and Result <= MyProfit Then NewStop = TradePrice ENDIF Endif If CondL and Not OnMarket then Buy 1 contract at Market Sell at StopLossL STOP Endif If CondS and Not OnMarket then SellShort 1 contract at Market ExitShort at StopLossS STOP Endif If OnMarket then Sell at max(StopLossL,NewStop) STOP ExitShort at min(StopLossS,NewStop) STOP Endif SET TARGET pPROFIT 50 |
Find exclusive trading pro-tools on