Operazione in profitto del 20% sul TP, vendere metà posizione e mettere SL a 0.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #243646 quote
    MARTINALA CARTINAMARTINALA CARTINA
    Participant
    New

    ciao a tutti,volevo fare un backtest pero non so come dire al programma,che una volta che l operazione è in profitto del 20% rispetto al TAKE PROFIT E in automatico venda metà posizione e metta lo stop a 0. GRAZIE

    #243708 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Eccolo:

    ONCE SL   = 100
    ONCE TP   = SL * 2
    ONCE Pc   = TP * 0.20          //20%
    ONCE Flag = 0
    
    IF OnMarket AND Flag = 0 THEN
       IF ((close - TradePrice) * PipSize) THEN
          SELL 1 CONTRACT AT MARKET
          Flag = 1
       ENDIF
    ENDIF
    
    Sma20 = average[20,0](close)
    IF Not OnMarket AND  close CROSSES OVER  Sma20 THEN
       BUY 2 Contract at Market
       Flag = 0
    ENDIF
    SET STOP   pLOSS   SL
    SET TARGET pPROFIT TP
    Iván González thanked this post
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Operazione in profitto del 20% sul TP, vendere metà posizione e mettere SL a 0.


ProBuilder: Indicatori & Strumenti Personalizzati

New Reply
Summary

This topic contains 1 reply,
has 1 voice, and was last updated by robertogozzirobertogozzi
1 year, 8 months ago.

Topic Details
Forum: ProBuilder: Indicatori & Strumenti Personalizzati
Language: Italian
Started: 02/09/2025
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...