Limiter le nombre max de shares avec la fonction CumulateOrders =true

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #6744 quote
    auvergnat
    Participant
    Veteran

    Bonsoir

    En utilisant la fonction CumulateOrders =true, je souhaite néanmoins limiter à par exemple 2 le nombre de shares à engager en buy ou sellshort. Avez vous une solution à m’apporter à coder?

    Merci par avance;

    Tof

    #6749 quote
    Nicolas
    Keymaster
    Master

    Bonjour, tu peux utiliser une des instructions dédiés à ProBacktest que tu retrouveras dans la documentation prorealtime en ligne du site, ce sont :

    COUNTOFLONGSHARES pour la quantité de shares en long orders

    et COUNTOFSHORTSHARES pour la quantité de shares en short orders.

    Il y a un exemple dans chacune des 2 instructions:

    myMACD = MACD[12,26,9](close)
    short = myMACD crosses under 0
    
    //first order
    IF NOT ShortOnMarket AND short THEN
       SELLSHORT 1 CONTRACTS AT MARKET
    ENDIF
    
    MAXSHARES = COUNTOFSHORTSHARES < 5
    
    //let's add another order while price continue to get higher (more than 10 points) than the last order taken with a condition of 5 bars elapsed since then
    IF TRADEINDEX(1)>5 AND TRADEPRICE(1)-Close>10 AND ShortOnMarket AND MAXSHARES THEN
       SELLSHORT 1 CONTRACTS AT MARKET
    ENDIF
    
    SET STOP TRAILING 50

    Dans cet exemple on limite le nombre de shares sur le marché en testant la variable MAXSHARES.

    Bodaris thanked this post
    #6840 quote
    auvergnat
    Participant
    Veteran

    Parfait. Merci.

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

Limiter le nombre max de shares avec la fonction CumulateOrders =true


Support ProOrder

New Reply
Author
author-avatar
auvergnat @auvergnat Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by auvergnat
9 years, 8 months ago.

Topic Details
Forum: Support ProOrder
Language: French
Started: 05/11/2016
Status: Active
Attachments: No files
Logo Logo
Loading...