chiudere posizione con un target statistico in percentuale %

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #223059 quote
    Steven11Steven11
    Participant
    Average

    Buonasera,  vorrei chiudere posizioni con un target “statistico” in percentuale una volta che il prezzo si è allontanato ad esempio di 0.75%  dal Pivot Giornaliero sia in acquisto che in vendita, il sistema entra a mercato al breakout con chiusura SOPRA o SOTTO il Pivot Giornaliero . Ringrazio in anticipo chi potrà aiutarmi.

    #223062 quote
    MauroProMauroPro
    Participant
    Veteran

    Prova questo, dovrebbe andare bene, provato sul Dax a 15m (Roberto magari controlla).

    defParam cumulateOrders = false
    defparam flatAfter = 220000
    positionSize = 1
    //—————————————————
    pivot = (dHigh(1) + dLow(1) + dClose(1))/3
    myPerc = 0.75
    xPerc = (close*myPerc/100)/pointSize

    myTargetL = pivot + xPerc
    myTargetS = pivot – xPerc
    myStopL = 0.5
    myStopS = 0.5

    if not onMarket and close crosses over pivot then
    buy positionSize contracts at market
    set stop %Loss myStopL
    set target price myTargetL
    endif

    if not onMarket and close crosses under pivot then
    sellShort positionSize contracts at market
    set stop %Loss myStopS
    set target price myTargetS
    endif

    //————————————————
    graphOnPrice pivot
    graphOnPrice myTargetL
    graphOnPrice myTargetS

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

chiudere posizione con un target statistico in percentuale %


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
Steven11 @steven11 Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by MauroProMauroPro
2 years, 10 months ago.

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