coding 2 different exit scenarios

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #92617 quote
    fredrikfx
    Participant
    Junior

    Hi guys!

    Can someone help me with this code:

    CLOSE if EMA34 crosses over EMA54 or if the price is reached 70 pips from entry

    If any of this conditions match, close the trade.

     

    Thanks in advance

    #92630 quote
    Nicolas
    Keymaster
    Master

    Topic moved to correct forum (about automatic trading) and title changed to a title ” explicit enough to prompt the community to read your discussion. “, please respect some rules while posting, thanks in advance.

    Here is the code you need:

    if average[34,1] crosses over average[54,1] then 
     sell at market
     exitshort at market  
    endif 
    
    set target pprofit 70

    Long and sell orders are closed in this code, since you didn’t specified which kind of orders you’d like to be closed by the condition ..

    “price is reached 70 pips from entry” is what we call a takeprofit.

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

coding 2 different exit scenarios


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
fredrikfx @fredrikfx Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by Nicolas
7 years ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 03/01/2019
Status: Active
Attachments: No files
Logo Logo
Loading...