basic programming query with automatic trading

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

    Hi there,

    I am a new ProRealTime user and just working my way through the programming manual in order to get to grips with the programming language!

    It would be ever so helpful if someone could tell me the correct code for the following – they are simple instructions, but it will just help with my understanding of how very basic coding works:

    1.) If price increases for 2 consecutive trading days, buy on the next day’s open and hold for 2 full days, then sell.

    2.) If current day’s close price is 2% above previous day’s close price, buy.

    If someone would be kind enough to tell me the code for the above lines, it would help me with a couple of areas of coding I’m stuck on!

    Many thanks,

    Rob

    #46116 quote
    robertogozzi
    Moderator
    Master

    As for question 1):

    Defparam cumulateorders = false
    IF (BarIndex - TradeIndex) = 2 THEN                               //After 2 bars close trade
       SELL      AT MARKET
    ENDIF
    IF close > open AND close > close[1] AND close[1] > close[2] THEN //3 consecutively rising bars
       BUY 1 CONTRACT AT MARKET
    ENDIF

    As for question 2):

    Defparam cumulateorders = false
    PriceDiff = close - close[1]                                //difference in Price
    IF close > close[1] AND PriceDiff >= (close[1] * 0.02) THEN //Trade only if current price is greater than 2%
       BUY 1 CONTRACT AT MARKET
    ENDIF

    I think they should do!

    Nicolas thanked this post
    #46131 quote
    roq1000
    Participant
    New

    Many thanks Roberto! That’s helped me a great deal!!

    All the very best,

    Rob

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

basic programming query with automatic trading


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
roq1000 @chequebook Participant
Summary

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

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