Roberto HELP, profit e q.tà contratti

Forums ProRealTime forum Italiano Supporto ProOrder Roberto HELP, profit e q.tà contratti

Viewing 2 posts - 1 through 2 (of 2 total)
  • #202027

    Roberto,

    sto impazzendo per impostare uno snippet che in funzione del profitto, aumentato o diminuito, suddiviso tra long e short, aumenta o diminuisce la quantità dei contratti.

    Tu, qui su forum, mi avevi messo quello che allego qui sotto. Ma secondo me non aumenta/diminuisce le q.tà nel modo giusto.

    Versione ROBERTO:

    //////////////////////// Q.TY CONTRACTS

    MS=1

    ONCE LongProfit  = 0

    ONCE ShortProfit = 0

    IF StrategyProfit <> StrategyProfit[1] AND BarIndex > 0 THEN

    Profitto = StrategyProfit – StrategyProfit[1]

    IF LongOnMarket[1] THEN

    LongProfit  = LongProfit  + Profitto

    ELSIF ShortOnMarket[1] THEN

    ShortProfit = ShortProfit + Profitto

    ELSE

    p1 = 1

    p2 = 2

    IF OnMarket THEN

    p1 = 2

    p2 = 3

    ENDIF

    IF TradePrice(p1) > TradePrice(p2) THEN

    IF Profitto > 0 THEN

    LongProfit  = LongProfit  + Profitto

    ELSE

    ShortProfit = ShortProfit + Profitto

    ENDIF

    ELSIF TradePrice(p1) < TradePrice(p2) THEN

    IF Profitto < 0 THEN

    LongProfit  = LongProfit  + Profitto

    ELSE

    ShortProfit = ShortProfit + Profitto

    ENDIF

    ELSE

    LongProfit  = LongProfit  + (Profitto / 2)

    ShortProfit = ShortProfit + (Profitto / 2)

    ENDIF

    ENDIF

    ENDIF

     

    /////////////////// for LONG trades

    once LotSizeL = 1

    Once MinSizeL = 1      //minimum size required

    Once LotSizeL = MinSizeL  //starting size (can be bigger than minimum)

    Once LotStepL = LL200 //250      //increase/decrease this money step

    LotSizeL = max(MinSizeL,round((MinSizeL/MS),1) + (MinSizeL * round((LongProfit / LotStepL),1)))

    if LotSizeL>MU then

    LotSizeL=MU-MMUU   //MU e MMUU metterli con decimale 0.5

    endif

    myLotL=LotSizeL

     

    ///////////////////// for SHORT trades

    once LotSizeS = 1

    Once MinSizeS = 1      //minimum size required

    Once LotSizeS = MinSizeS  //starting size (can be bigger than minimum)

    Once LotStepS = LS200 //250      //increase/decrease this money step

    LotSizeS = max(MinSizeS,round((MinSizeS/MS),1) + (MinSizeS * round((ShortProfit / LotStepS),1)))

    if LotSizeS>MU then

    LotSizeS=MU-MMUU   //MU e MMUU metterli con decimale 0.5

    endif

    myLotS=LotSizeS

    //////////////////////////////////// END

     

    Io adesso ho provato a farlo in questo modo ma non mi apre alcuna posizione:

    ONCE LongP = 0
    ONCE ShortP = 0
    once myLot=0.5
    IF StrategyProfit <> StrategyProfit[1] AND BarIndex > 0 THEN
    Profitto = StrategyProfit – StrategyProfit[1]
    IF LongOnMarket[1] THEN
    LongP = LongP + Profitto
    ELSIF ShortOnMarket[1] THEN
    ShortP = ShortP + Profitto
    ENDIF
    endif

    if LongP > LongP[1] and LongP => LL200 then
    myLotL = (myLotL + round((MS)*FXLL))
    endif
    if LongP < LongP[1] and LongP <= LL200 and myLotL > MS then
    myLotL = (myLotL – round((MS)*FXLS))
    endif

    if ShortP > ShortP[1] and ShortP => LS200 then
    myLotS = (myLotS + round((MS)*FXSL))
    endif
    if ShortP < ShortP[1] and ShortP <= LS200 and myLotS > MS then
    myLotS = (myLotS – round((MS)*FXSS))
    endif

    GRAZIE PER L’AIUTO !!!!!

    #202301

    Ho provato, ma mancano alcune variabili.

    Posta il file ITF.

     

Viewing 2 posts - 1 through 2 (of 2 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login