code is not place second order

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #87446 quote
    ramarama
    Participant
    Senior
    //-------------------------------------------------------------------------
    // Main code : positionprices_trade(1)
    //-------------------------------------------------------------------------
    // Definition of code parameters
    DEFPARAM CumulateOrders = true// Cumulating positions deactivated
    x=1
    if not onmarket and time > 080800 and time < 210000 then
    
    BUY 1 PERPOINT AT low[10]+x stop
    
    
    
    SELLSHORT 1 PERPOINT AT high[10]-x stop
    
    
    endif
    set stop loss 10
    
    set target profit 100
    
    
    if longonmarket then
    BUY 1 PERPOINT AT 1.0004*positionprice stop
    
    endif
    
    if shortonmarket then
    sellshort 1 PERPOINT AT 0.9996*positionprice stop
    
    endif
    
    c1= 0.9996*positionprice
    c2=1.0004*positionprice
    
    if close<=c1 and longonmarket then
    sell at market
    endif
    
    if close>=c2 and shortonmarket then
    exitshort at market
    endif
    

    this is placing only order even price is moved from the original order by 24 pips

    I am telling the system to sell or buy in the same direction of the trend by roughly even 4 points move

    #87449 quote
    robertogozzirobertogozzi
    Moderator
    Legend

    At lines 9 and 13 you should do some math to  choose whether LIMIT or STOP should be applied to any pending order, otherwise they could be entered at market.

    I guess you are using this strategy not on a FX pair, since line 6 for currencies should be (though it should ALWAYS be, no matter what instrument you are trading):

    x=1*pipsize

    As for your last two lines, I can’t understand thoroughly what they mean, so I’m asking you to better explain your issue.

    #87450 quote
    VonasiVonasi
    Moderator
    Master

    Your lines like this one for example:

    BUY 1 PERPOINT AT 1.0004*positionprice stop

    is buying if price moves 0.04% above the current position price. You are talking in pips in your question not %.

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

code is not place second order


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
rama @rama Participant
Summary

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

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 12/19/2018
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...