Problem with my coding (Lines 12 & 17)

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #143427 quote
    patel_kaushik
    Participant
    New

    Hi,

    Good morning and hope you are in good health.

    Please can you check the following code – the program does not like lines 12 & 17.

    //BUYDAX01
    
    Q = 0.5
    Q3 = Q * 3
    Q32 = Q3 * 2
    OFFSET = 5.0
    
    BUY Q PERPOINT AT MARKET
    
    // If the above BUY is executed THEN to place a SELL pending order
    If LongOnMarket THEN
    SELL Q3 PERPOINT AT (TRADEPRICE - OFFSET)
    ENDIF
    
    // If the above SELL is executed THEN to place a BUY pending order
    IF ShortOnMarket THEN
    BUY Q32 PERPOINT AT (TRADEPRICE + OFFSET)
    ENDIF
    
    // Stops and targets : Enter your protection stops and profit targets here
    #143428 quote
    robertogozzi
    Moderator
    Master

    Firstly OFFSET could not have a 1:1 ratio with price, so you’d better write it as

    OFFSET = 5.0 * pipsize

    Secondly TRADEPRICE is not known until a bar has elapsed since you last opened a position, thus it can be 0 the very first trade or the closing price of the previously closed trade.

    #143439 quote
    Vonasi
    Moderator
    Master

    patel_kaushik – Always use the ‘Insert PRT Code’ button when posting code in any future topics to make it easier for other to read/copy – as per the forum rules. I have tidied up your last post.

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

Problem with my coding (Lines 12 & 17)


ProBuilder: Indicators & Custom Tools

New Reply
Author
Summary

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

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 09/05/2020
Status: Active
Attachments: No files
Logo Logo
Loading...