Evitare il reverse

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #140773 quote
    danistuta
    Participant
    Senior

    Salve, avendo un codice che integra sia il long che lo short vorrei evitare che in automatico al verificarsi della nuova condizione, inverta la posizione.
    Vorrei che lo script tenga per esempio il long, fino allo stop loss o al take profit: separando il codice in due diversi script ovviamente riesco a farlo, ma vorrei poterlo fare aprendo un solo task.

    Grazie mille.

    #140780 quote
    robertogozzi
    Moderator
    Master

    Basta che dove c’è BUY verifichi di non essere già Short e dove c’è SELLSHORT di non essere già Long:

    IF MieCondizioniLong  AND Not ShortOnMarket THEN
       BUY ....
    ENDIF
    IF MieCondizioniShort AND Not LongOnMarket  THEN
       SELLSHORT ....
    ENDIF

    in questo modo puoi accumulare posizioni nella stessa direzione, ma NON invertire.

    Se NON vuoi neppure accumulare posizioni, sostituici ShortOnMarket e LongOnMarket con OnMarket.

    #141043 quote
    danistuta
    Participant
    Senior

    Grazie mille!:-)

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

Evitare il reverse


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
danistuta @danistuta Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by danistuta
5 years, 6 months ago.

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 08/03/2020
Status: Active
Attachments: No files
Logo Logo
Loading...