Codice breakeven chiarimento

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #145215 quote
    danistuta
    Participant
    Senior
    //Break even
    breakevenPercent = 830
    PointsToKeep = 4
    startBreakeven = tradeprice(1)*(breakevenpercent/100)
    
    once breakeven = 1//1 on - 0 off
    //reset the breakevenLevel when no trade are on market
    if breakeven>0 then
    IF NOT ONMARKET THEN
    breakevenLevel=0
    ENDIF
    // --- BUY SIDE ---
    //test if the price have moved favourably of "startBreakeven" points already
    IF LONGONMARKET AND close-tradeprice(1)>=startBreakeven*pipsize THEN
    //calculate the breakevenLevel
    breakevenLevel = tradeprice(1)+PointsToKeep*pipsize
    ENDIF
     
    //place the new stop orders on market at breakevenLevel
    IF breakevenLevel>0 THEN
    SELL AT breakevenLevel STOP
    ENDIF
    // --- end of BUY SIDE ---
     
    IF SHORTONMARKET AND tradeprice(1)-close>startBreakeven*pipsize THEN
    //calculate the breakevenLevel
    breakevenLevel = tradeprice(1)-PointsToKeep*pipsize
    ENDIF
    //place the new stop orders on market at breakevenLevel
    IF breakevenLevel>0 THEN
    EXITSHORT AT breakevenLevel STOP
    ENDIF
    endif

    Ho preso questo codice da uno script per wall street, l’ho poi inserito su EUR/USD . Il valore originario della percentuale del breakeven era di “0.15” e non capisco come mai invece sul forex ho dovuto inserire valori molto più alti, tipo “890” per ottenere percentuali proporzionate…cosa mi sfugge nel codice? Mi piacerebbe inserire la percentuale corretta.

    Grazie mille.

    #145226 quote
    robertogozzi
    Moderator
    Master

    Alla riga 14 e alla 25 togli PIPSIZE, in quanto è già un prezzo, non pips, quindi non va convertito startBreakeven.

    #145237 quote
    danistuta
    Participant
    Senior

    Grazie!:-)

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

Codice breakeven chiarimento


ProOrder: Trading Automatico & Backtesting

New Reply
Author
author-avatar
danistuta @danistuta Participant
Summary

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

Topic Details
Forum: ProOrder: Trading Automatico & Backtesting
Language: Italian
Started: 09/24/2020
Status: Active
Attachments: No files
Logo Logo
Loading...