Aiuto per la variazione del numero dei contratti

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #141671 quote
    Zampa
    Participant
    Senior

    Buongiorno,

    mi serve aiuto !! non riesco a modificare le quantità dei contratti nel codice allegato.

    Grazie a tutti

    nn-si-sa-m.a.-colorata-bull.itf
    #141673 quote
    robertogozzi
    Moderator
    Master

    Se posti il codice, usando il pulsante “Insert PRT code” è meglio, così si può vedere senza doverlo scaricare e installare.

    Dai un titolo significativo al tuo argomento. Descrivi la tua domanda o l’oggetto nel titolo. Non utilizzare titoli privi di significato come “Aiuto per la codifica”.

    #141674 quote
    Zampa
    Participant
    Senior
    //-------------------------------------------------------------------------
    // Codice principale : nn si sa m.a. colorata bull
    //-------------------------------------------------------------------------
    //SPEAD = 2.5
    //Capital = £500
    //Trading hours from DAX open until NYSE close. No after hours trading.
    //Time is UTC +2 (South Afica time)
    
    DEFPARAM CumulateOrders = false // Cumulating positions deactivated
    
    a=average[z] (close)
    if a[1]<a then
    alex=100
    endif
    
    if a[1] > a then
    alex=50
    endif
    
    // Prevents the system from creating new orders to enter the market or increase position size before the specified time
    noEntryBeforeTime = 090000
    timeEnterBefore = time >= noEntryBeforeTime
     
    // Prevents the system from placing new orders to enter the market or increase position size after the specified time
    noEntryAfterTime = 173000
    timeEnterAfter = time < noEntryAfterTime
     
    // Conditions to enter long positions
    indicator1 = WeightedAverage[x](totalPrice)
    c1 = (High CROSSES OVER indicator1)
    indicator2 = WeightedAverage[y](totalPrice)
    c2 = (low CROSSES OVER indicator2)
     
    IF (c1 AND c2) AND timeEnterBefore AND timeEnterAfter and COUNTOFPOSITION=0 and alex=100 THEN
    Buy 1 CONTRACT AT MARKET
    ENDIF
    
    indicator3 = WeightedAverage[x](totalPrice)
    c3 = (low CROSSES UNDER indicator3)
    indicator4 = WeightedAverage[y](totalPrice)
    c4 = (High CROSSES UNDER indicator4)
     
    IF (c3 AND c4) AND timeEnterBefore AND timeEnterAfter and COUNTOFPOSITION=0 and alex=50 THEN
    SellShort 1 CONTRACT AT MARKET
    ENDIF
    
    // Stops and targets
    SET TARGET $PROFIT 10
    SET STOP $LOSS 200

    Perfetto, provo !! (è la prima volta)

    Grazie.

    #141675 quote
    robertogozzi
    Moderator
    Master

    Basta che tu sostituisca 1 con un altro numero alle righe 35 e 44.

    Dovrai adeguare anche i valori delle righe 48 e 49. Se passi da 1 a 2 contratti anche quei valori andranno moltiplicati per due, altrimenti in realtà si dimezzerebbero perché rischieresti e guadagneresti la stessa somma ma con 2 contratti anziché 1.

    #141696 quote
    Zampa
    Participant
    Senior

    Perfetto Roberto, ora funziona come un orologio Svizzero !!
    Ti ringrazio e a presto.
    Ciao.

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

Aiuto per la variazione del numero dei contratti


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
Zampa @zampa Participant
Summary

This topic contains 4 replies,
has 2 voices, and was last updated by Zampa
5 years, 7 months ago.

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