Apertura trade una sola volta a condizione

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #111182 quote
    okeusokeus
    Participant
    Senior
    // Definizione dei parametri del codice
    DEFPARAM CumulateOrders = False // Posizioni cumulate disattivate
    // Il sistema cancellerà tutti gli ordini in attesa e chiuderà tutte le posizioni a 0:00. Dopo l'orario "Flat Before" non saranno piazzati nuovi ordini o posizioni.
    DEFPARAM FLATBEFORE = 090000
    // Cancellare tutti gli ordini in attesa e chiudere tutte le posizioni all'orario "Flat After"
    DEFPARAM FLATAFTER = 211500
    
    // Condizioni per entrare su posizioni long
    indicator1 = SuperTrend[s,t]
    c1 = (close[1] > indicator1)
    
    IF c1 THEN
    BUY 1 CONTRACT AT MARKET
    ENDIF
    
    // Condizioni per uscire da posizioni long
    indicator2 = SuperTrend[s,t]
    c2 = (close[1] < indicator2)
    
    IF c2 THEN
    SELL AT MARKET
    ENDIF
    
    // Condizioni per entrare su posizioni short
    indicator3 = SuperTrend[s,t]
    c3 = (close[1] < indicator3)
    
    IF c3 THEN
    SELLSHORT 1 CONTRACT AT MARKET
    ENDIF
    
    // Condizioni per uscire da posizioni short
    indicator4 = SuperTrend[s,t]
    c4 = (close[1] > indicator4)
    
    IF c4 THEN
    EXITSHORT AT MARKET
    ENDIF
    

    buongiorno, mi servirebbe correggere il programma per capire come posso fare per avere una sola entrata dopo che si è attivata la condizione, indipendentemente che sia scattato lo stop o il profit   grazie

    #111203 quote
    Prova questo. 
    
    if intradaybarindex = 0 then
    countposition=0
    endif
    condnbposperday=countposition < 1
    if not longonmarket and entrata and condnbposperday then
    buy 1 shares at market
    countposition=countposition+1
    endif
    robertogozzi thanked this post
    #111207 quote
    okeusokeus
    Participant
    Senior

    grazie provo subito

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

Apertura trade una sola volta a condizione


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
okeus @okeus Participant
Summary

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

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 10/25/2019
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...