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

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #6744 quote
    auvergnatauvergnat
    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
    NicolasNicolas
    Keymaster
    Legend

    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
    auvergnatauvergnat
    Participant
    Veteran

    Parfait. Merci.

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

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


ProOrder : Trading Automatique & Backtests

New Reply
Author
author-avatar
auvergnat @auvergnat Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by auvergnatauvergnat
10 years, 5 months ago.

Topic Details
Forum: ProOrder : Trading Automatique & Backtests
Language: French
Started: 05/11/2016
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...