New to pro trader and need help writing a simple algo

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #131414 quote
    haroon
    Participant
    New

    I am fairly new to pro trader real time. I need help writing the following algos:

     

    Algo 1: Go long

    1. For all stock instruments, check if today’s opening price is greater than yesterday’s closing price by at least 1%, if so proceed to step 2
    2. Check if current price is greater than today’s opening price by at least 3%, if so execute a long position

    Algo 2: Go short

    1. For all stock instruments, check if today’s opening price is less than yesterday’s closing price by at least 1%, if so proceed to step 2
    2. Check if current price is less than today’s opening price by at least 3%, if so execute a short position

    Once I have this algo defined, how do I run a backtest?

     

    Thanks for your help

    #131427 quote
    robertogozzi
    Moderator
    Master

    There you go (not tested):

    DEFPARAM CumulateOrders = false
    L1 = open > (close[1] * 1.01)
    S1 = open < (close[1] * 0.99)
    L2 = close > (open * 1.03)
    S2 = close < (open * 0.97)
    Lcond = L1 and L2
    Scond = S1 and S2
    If Lcond and not LongOnMarket then
       Buy 1 contract at market
    Endif
    If Scond and not ShortOnMarket then
       Sellshort 1 contract at market
    Endif
    Set Stop pLoss 50
    Set Target pProfit 100

    this code will do a Stop & Reverse, if needed.

    If you don’t want this then replace LONGONMARKET and SHORTONMARKET with ONMARKET.

    #131428 quote
    Philstrading
    Participant
    Senior

    I’m a new bod also, but you can learn a lot from the free videos, https://www.prorealcode.com/courses/training-program-introduction-programming-prorealtime/ and there’s a 2nd course payable but likely worth a look… this will get you into the basics.

    #131429 quote
    robertogozzi
    Moderator
    Master

    To backtest it, just set the backtest period after setting enough units for your TF, capital, spread and commissions if any, then click on the start backtest button.

    You may also want to tick the tick-by-tick option.

    On YouTube you’ll find a ProRealTime channel with many tutorials.

    #131576 quote
    haroon
    Participant
    New

    This is great thank you guys for the prompt reply! I want to develop a trading strategy that is instrument agnostic. So for the backtesting how do I apply the algorithm written above to the various markets like FTSE 100, FTSE AIM etc. Can I only backtest one instrument at a time or can I apply it to the entire market?

     

    As I am not familiar with the abilities or limitations of the Pro Trade system. Can you also clarify whether algorithms can be applied to either individual securities or an entire market similar to how the screener works?

    I have accessed the algorithm tool and it looks as though I can only apply it to one security at a time, please kindly clarify

    Thanks again for you help

    #131577 quote
    robertogozzi
    Moderator
    Master

    Version 10.3 (currently the one supported by IG) only allows 1 instrument at a time.

    Version 11.x (supported by PRT and IB, maybe BINCK as well) allows up to 3 different instruments to be backtested at any one time.

    You will have to duplicate your strategy and name it differently for each instrument.

    #131578 quote
    haroon
    Participant
    New

    Thanks Roberto for your help

    As I am not familiar with the abilities or limitations of the Pro Trade system. Can you also clarify whether algorithms can be applied to either individual securities or an entire market similar to how the screener works?

    I have accessed the algorithm tool and it looks as though I can only apply it to one security at a time, please kindly clarify

    #131579 quote
    robertogozzi
    Moderator
    Master

    No, algortithms can be applied only to one instrument with v10.3 (see info on the Help menu) and 3 instruments on v11.x.

    If you have v11.x (premium) you can add up to 3 different strategies to your backtest (see atteched pic).

    In any case, whatever version you have you can launch multiple instances of ProBackTest, so on v10.3 you can backtest up to 1, 2, 3 strategies at a time, while on v11.x yoy can backtest up to 3, 6, 9 different strategies at a time.

    PRT have a YouTube channel with many video tutorials about the many features and tools they have.

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

New to pro trader and need help writing a simple algo


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
haroon @haroon Participant
Summary

This topic contains 7 replies,
has 3 voices, and was last updated by robertogozzi
5 years, 9 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 05/13/2020
Status: Active
Attachments: 1 files
Logo Logo
Loading...