POSIZIONI LONG/SHORT

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #53739 quote

    Buongiorno , avrei gentilmente bisogno di un aiuto.

    Vorrei una volta chiusa un’operazione Short, quella successiva deve essere solo Long ed evitare un’apertura ancora Short.

    Grazie 

    Mauro

    #53742 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Inserisci all’inizio una variabile, che dovrà essere sempre aggiornata quando un trade è aperto:

    ONCE UltimoTrade = 0       //1=long    2=short
    IF LongOnMarket THEN
       UltimoTrade = 1
    ELSIF ShortOnMarket THEN
       UltimoTrade = 2
    ENDIF

    successivamente, quando devi dare il BUY scrivi:

    IF UltimoTrade = 2 AND Tue_Condizioni THEN
       BUY ....
    ENDIF

    in modo che solo quando UltimoTrade = 2 (cioè precedentemente eri sndato SHORT) esegue il BUY, se anche le tue condizioni sono verificate.

    Lo stesso per gli SHORT:

    IF UltimoTrade = 1 AND Tue_Condizioni THEN
       SELLSHORT...
    ENDIF

    Non l’ho provato, ma a rigor di logica dovrebbe funzionare. Fammi sapere. Roberto

    #53747 quote

    GRAZIE 

    Funziona perfettamente.

    #53748 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Scusami, le righe del BUY e del SELLSHORT vanno così modificate, altrimenti non parte mai:

    IF UltimoTrade <> 1 AND Tue_Condizioni THEN   //BUY
    
    IF UltimoTrade <> 2 AND Tue_Condizioni THEN   //SELLSHORT
    Nicolas thanked this post
    #53749 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Funzionava? Strano, perchéP all’inizio vale 0, quindi il BUY e SELLSHORT che verificano 1 o 2, come potevano eseguire un trade?

     

    #53750 quote

    Ok Grazie

    #53794 quote

    Funziona in statistica…. Ora la provo in demo. 

Viewing 7 posts - 1 through 7 (of 7 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

POSIZIONI LONG/SHORT


ProOrder: Trading Automatico & Backtesting

New Reply
Author
Summary

This topic contains 6 replies,
has 2 voices, and was last updated by Mauro T. "Algorithm System"Mauro T. “Algorithm System”
8 years, 10 months ago.

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 11/23/2017
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...