Da Input market

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #215768 quote
    Mut1974Mut1974
    Participant
    New

    Ciao, dovrei dare un comando da quando sono entrato a mercato. Ossia:

    Da questo punto: BUY 1 Contract at Market

    Vorrei a questo punto, per esempio, dire che se sale di 4 punti inserisca 1 altro lotto.

    Grazie mille.

    #215804 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    Eccolo:

    DEFPARAM CumulateOrders = True
    IF Not OnMarket THEN
       Prezzo = 0
    ENDIF
    IF TradePrice > Prezzo AND LongOnMarket THEN
       Prezzo = TradePrice
    ENDIF
    MieCondizioniLongIniziali = close CROSSES OVER Average[10,0](close) AND Not LongOnMarket
    IF MieCondizioniLongIniziali THEN
       BUY 1 CONTRACT AT MARKET
    Prezzo = close
    ENDIF
    IF Prezzo > 0 AND close >= (Prezzo + 4*PipSize) AND LongOnMarket THEN
    BUY 1 CONTRACT AT MARKET
    Prezzo = close
    ENDIF
    IF close CROSSES UNDER Average[10,0](close) AND LongOnMarket THEN
    SELL AT MARKET
    ENDIF
    //graphonprice Prezzo coloured("Green")
    //graphonprice TradePrice
    Mut1974 thanked this post
    #216001 quote
    Mut1974Mut1974
    Participant
    New

    Grazie ancora del codice, però sono ancora alle prime armi.

    Cortesemente potresti scrivere alla fine del codice // a cosa serve

    Grazie

    #216035 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    // serve per commentare una riga. Si usa:

    1. per facilitare la comprensione del codice quando si abbandona per mesi e poi lo si riprende, evitando di dimenticarsi perché erano state messe delle istruzioni
    2. per usare righe utili al debugging (ricerca di eventuali errori)  durante un backtest; righe, come in questo caso, che non possono essere usate nelle strategie da eseguire in autotrading.

    Le due righe sopra dervono a visualizzare i due diversi prezzi sul grafico (come da punto 2). Se vuoi provare ad utilizzarle in backtest e vedere a cosa servono, basta che togli le due barre iniziali e fai il backtest.Quando non ti servono più rimetti le due barre oppure cancelli interamente le due righe.

    Mut1974 thanked this post
Viewing 4 posts - 1 through 4 (of 4 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

Da Input market


ProBuilder: Indicatori & Strumenti Personalizzati

New Reply
Author
author-avatar
Mut1974 @mut1974 Participant
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by robertogozzirobertogozzi
3 years, 3 months ago.

Topic Details
Forum: ProBuilder: Indicatori & Strumenti Personalizzati
Language: Italian
Started: 06/07/2023
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...