OnTick MQL4 equivalent in ProRealCode

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #174056 quote
    phanz
    Participant
    Average

    Hi,  is there OnTick equivalent of MQL4 in ProRealCode?  Tks

    #174058 quote
    Nicolas
    Keymaster
    Master

    For indicators, you can use “IsLastBarUpdate” which trigger a code read on each tick on the last (current) bar.

    With automated trading, the code is only read once at bar close. You can interact during the bar by using MTF instruction, as explained in this topic: First approach to multi timeframe trading with ProRealTime

    #174064 quote
    phanz
    Participant
    Average

    Thank you for your prompt response.  I really appreciate it.  If its not too much of a trouble, wondering if you can advise me with the code.

    Example of strategy:

    On 1-hour time frame:

    Buy when the price is below (on closing) the lower band of Bollinger Band (2 SD, 50 interval), entry at the next bar open;

    Sell when the price is above the higher band of the Bollinger Band (1 SD, 50 interval), at the instance the price pierce through the BBand level;

     

    The code generated from the simplified creation is shown below.  How can I modify the code to meet the conditions above?

     

    Thank you very much.

     

    // Definition of code parameters
    DEFPARAM CumulateOrders = False // Cumulating positions deactivated

    // Conditions to enter long positions
    indicator1 = BollingerDown[50](close)
    c1 = (indicator1 <= close)

    IF c1 THEN
    BUY 1 SHARES AT MARKET
    ENDIF

    // Conditions to exit long positions
    indicator2 = BollingerUp[50](close)
    c2 = (close >= indicator2)

    IF c2 THEN
    SELL AT MARKET
    ENDIF

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

OnTick MQL4 equivalent in ProRealCode


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
phanz @phanz Participant
Summary

This topic contains 2 replies,
has 2 voices, and was last updated by phanz
4 years, 6 months ago.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 07/23/2021
Status: Active
Attachments: No files
Logo Logo
Loading...