exit the very next day

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

    hi there,

    i want to back test a strategy bassed on heikin-ashi. i have the conditions for entry the market and i want to exit the very next day after the entry point no matter what (or even the second day after the entry point).

    how should i code this? (i dont know what follows the if command for sell at market)

    thank you.

    // Definition of code parameters
    DEFPARAM CumulateOrders = False // Cumulating positions deactivated
    
    //special calculation of H.A.
    once xOpen = open
    xClose     = (open + close + high + low) / 4
    if barindex > 0 then
    xOpen  = (xOpen + xClose[1]) / 2
    endif
    
    c1 = xOpen < xclose //now H.A. bullish
    
    c2 = xOpen[1] >= xclose[1] //H.A.[1] bearish
    
    // Conditions to enter long positions
    
    IF c1 and c2 THEN
    BUY 1 SHARES AT MARKET
    ENDIF
    
    // Conditions to exit long positions
    
    IF      THEN
    SELL AT MARKET
    ENDIF
    #164885 quote
    robertogozzi
    Moderator
    Master

    The second day AFTER the entry points is a day later than the VERY NEXT day from to entry.

    If you move lines 21-25 to line 10 you will be able to exit the very next day from entry.

    #164909 quote
    Vonasi
    Moderator
    Master

    gnellas77 – Your topic has been moved to the correct forum which is the ProOrder forum for strategy subjects. Please be more careful with future topics to ensure that they are posted in the correct place.

    _ ProRealTime Platform Support: only platform related issues.
    _ ProOrder: only strategy topics.
    _ ProBuilder: only indicator topics.
    _ ProScreener: only screener topics
    _ General Discussion: any other topics.
    _ Welcome New Members: for new forum members to introduce themselves.

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

exit the very next day


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
gnellas77 @gnellas77 Participant
Summary

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

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 03/22/2021
Status: Active
Attachments: No files
Logo Logo
Loading...