Breakeven with little gain

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

    Hello,

    i have a strategy that work in EURUSD pair and I want to add a protective stop loss when the current order reach a determinate level o profit. I want to add these protection in addition to traditional stop loss and take profit. Below the code. The strategy work in IG CFD account. It’s correct ?

    //when the strategy reach a gain of 50$ set the breakeven with a profit of 5$
    
    If LongOnmarket and (close[1]- tradeprice)>= 0.05 then
    sell at (tradeprice + 0.005) limit
    endif
    
    //when the strategy reach a gain of 50$ set the breakeven with a profit of 5$
    If shortONmarket and (tradeprice-close[1])>= 0.05 then
    exitshort at (tradeprice - 0.005) limit
    endif
    
    SET STOP $LOSS 90
    SET TARGET $PROFIT 100
    #9251 quote
    NicolasNicolas
    Keymaster
    Legend

    Hi,

    I think you should use the instruction PIPVALUE to calculate the real value in money of a pips difference:

    If LongOnmarket and (close[1]- tradeprice)>= 50/pipvalue then

    That way, your code will be universal with all traded instruments.

    Also, to exit a long position below the actual price, you’ll have to use a STOP order and not a LIMIT one. It is the same to exit a short position (use STOP order instead).

    exitshort at (tradeprice - 5/pipvalue) STOP
    #9276 quote
    volpiemanuelevolpiemanuele
    Participant
    Veteran

    Tanks !!!

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

Breakeven with little gain


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

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

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 06/11/2016
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...