Opening position after 'event'. But no more then once, until next 'event'.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #5814 quote
    AutoTrader
    Participant
    New

    Hi fellow ProRealCode users,

    I have been testing and trying stuff for the past month, but cant seem to get the code right for a specific action.

    I want to open a position when the indicators cross over.  , but I don’t want to open a extra position after that. (when first position is closed with profit)   I only want to open again after the indicators crossed over again.

    Something like this in normal words;

    // Conditions to enter long positions
    indicator1 = ExponentialAverage[5](close)
    indicator2 = ExponentialAverage[20](close)
    c1 = (indicator1 > indicator2[1])
    c2 = (indicator1 < indicator2[1])
     
    IF c1 THEN
     BUY 1 CONTRACT AT MARKET
    ENDIF
    IF c1 but c2 hasent happend yet, don’t BUY 1 CONTRACT AT MARKET.   (<– What I mean is ;  after the c1 happened, and a contract is bought ,  only buy another one , when c2 happened. In the backtest it opens the trade correctly , and closes with a pPROFIT.  But the next candle it opens again , because c1 is still valid. I want c2 to happen first , and then if c1 happens open another trade.)

    Hopefully someone has an idea how to set this up…  Its a guaranteed moneymaking machine… 😉 ;p

    #5831 quote
    Nicolas
    Keymaster
    Master

    Hi AutoTrader,

    Basically, what you want to do here is to test a crossover between 2 values, like moving average.

    ProRealTime has instructions built in to test these conditions, they are called : CROSSES OVER and CROSSES UNDER

    So your c1 and c2 conditions would be:

    c1 = indicator1 crosses over indicator2
    c2 = indicator1 crosses under indicator2

    I believe that would make it, am I right?

    #5845 quote
    AutoTrader
    Participant
    New

    Hi Nicolas,

    That is correct!  Thank you!   Made a very simple system that scores 100%  on the 5min Dax cash. (backtest)    Will live test it next week Monday until Friday.

    Thanks for pointing out the crossover!

    #5864 quote
    Adolfo
    Participant
    Senior

    Share it! 😉

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

Opening position after 'event'. But no more then once, until next 'event'.


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
AutoTrader @autotrader Participant
Summary

This topic contains 3 replies,
has 3 voices, and was last updated by Adolfo
9 years, 10 months ago.

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