OnTick MQL4 equivalent in ProRealCode

Forums ProRealTime English forum ProBuilder support OnTick MQL4 equivalent in ProRealCode

Viewing 3 posts - 1 through 3 (of 3 total)
  • #174056

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

    #174058

    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

    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)

Create your free account now and post your request to benefit from the help of the community
Register or Login