A Few Basic Questions about automatic trading

Forums ProRealTime English forum ProOrder support A Few Basic Questions about automatic trading

Viewing 5 posts - 1 through 5 (of 5 total)
  • #46405

    Hello All,

    I have a few questions which I would appreciate if someone could answer or point me to the right area.

    Question 1.  I seem to be getting a timing error with a moving average crossover command that I am using to exit long and short positions.  Example (see attachment 1), ProBacktest has entered long at 1,322.1 using an 80 second bar.  The exit command is below which has been compiled using simplified creation.  However, the system seems to exit the position immediately after it has entered due to the fact that the 5EMA crossed under the 10EMA the period prior to taking the position.  I don’t understand how this exit command would be valid when I had no positions at the time?  or am I missing something?

    //conditions to exit long positions
    indicator2 = ExponentialAverage[5](close)
    indicator3 = ExponentialAverage[10](close)
    c2 = (indicator2 CROSSES UNDER indicator3)

    IF c2 THEN
    SELL AT MARKET
    ENDIF

    Question 2.  In ProBacktest and ProOrder Auto Trading is there a way to enter and exit positions based on criteria other than “Next bar open” (see attachment 2)?  Ideally I would like the option to enter “at market”.

    Question 3.  What benefits does ProRealTime Premium have in the automatic trading area other than the ability to analyse more history?

    Thanks in advance for your help guys.  It’s much appreciated.  Lucas.

    #46417

    Question 1.) I have no clue about this “creation wizard” of PRT, I´m programming the old-fashioned way.

    Question 2.) I think this is the same. Market orders are always entered on the next bars open so I think you should read it “buy market on the next bars open”.

    Question 3.) Have a look here: https://www.prorealtime.com/en/technology_premium

    #46437

    Your strategy is likely to have entered a trade because of certain conditions you have written, then immediately exited because also the closing conditions were met!

    Without the complete code it’s impossible to determine why it happened. Your example is fine and the trade was correctly closed. What is to be investigated is why it was opened!

     

    #46440

    Hi Roberto, you are correct.  It entered because the large red bar at around 8:28 crossed under the green EMA which triggered the command to buy the next bar’s open.  But, the pink EMA also crossed under the black EMA on the same bar which triggered a command to exit long positions on the next bar’s open.  Therefore the system entered and exited on the red bar at 8:30.  Logically, I thought the system would recognise that I did not have a long position open when the pink EMA crossed under the black EMA so the command to exit long positions would be ignored until I held long positions during the cross under.

    #46443

    @Lucas1

    You can check if you are already on market or not with ONMARKET keyword. I suggest you to have a look at all ProOrder/ProBacktest instructions available, they are explained in this part of our online documentation: https://www.prorealcode.com/documentation/category/probacktest/

Viewing 5 posts - 1 through 5 (of 5 total)

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