tradeprice / entryprice

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

    Hi guys

     

    I have written a probacktest code which enters short and long trades based on an indicator signal. what I am wanting to do is optomise it so that it enters an optimised number of pips above or below the entry signal.

    Please see attached ITF file which I hope will give you some idea of what I mean.

    // Definition of code parameters
    DEFPARAM CumulateOrders = False // Cumulating positions deactivated
    // Conditions to enter long positions
    ignored, indicator2 = CALL “123v2″[70, 30, 14]
    c1 = (indicator2 < 0)

    IF c1 and (tradeprice – (a)) THEN
    BUY 1 PERPOINT AT MARKET
    ENDIF

    // Conditions to enter short positions
    indicator5, ignored = CALL “123v2″[70, 30, 14]
    c3 = (indicator5 > 0)

    IF c3 and (tradeprice + (b)) THEN
    SELLSHORT 1 PERPOINT AT MARKET
    ENDIF

    // Stops and targets

    SET TARGET pPROFIT (c)

     

    Many thanks in anticipation.

    123v2-Daily1.itf
    #216951 quote
    robertogozzi
    Moderator
    Master

    Line 7, (tradeprice – (a)), is always negative because it is missing something you need to compare (tradeprice – (a)) to something… what, maybe CLOSE?

    Forthermore, condition C1 is always 0 (not met). You should check the value returned by indicator2, appending this instruction to your code:

    GRAPH indicator2
    #217195 quote
    LivJoJade
    Participant
    New

    Hi Roberto, many thanks for your reply

    you are correct the indicator (see attached) is by default at “0” unless a divergence is identified.

    I then have a proscreener (again attached) for which I’d appreciate a little guidance. I can search for the MA direction and the 4hr Bollinger periodically  but when it comes to an indicator signal for the previous 8 x 1hr or 16 x 30 minutes but is there a way to search for the previous 16 candles without going [1], [2], [3] thru to [16] or can you go [1 – 16]

    And finally, with the probacktest and entry is made at the close of the candle delivering the >0 (buy) or <0 (sell) signal, what I’m trying to ascertain is the optimum historical price above that close (based on previous entry points) to finally enter the trade, i suppose in a roundabout way the average drawdown based on previous trades.

    Many thanks in anticipation

    Chris

    123v2-Daily1.itf 123-Bolly-RSI.itf daily-4hr.itf
    #218949 quote
    robertogozzi
    Moderator
    Master

    You should add PipSize as a multiplier for a, b and c, such as:

    (tradeprice - (a*pipsize)

    moreover, TRADEPRICE is always 0, what is exactly the price you want to use in the expression, why did you use TRADEPRICE?

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

tradeprice / entryprice


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
LivJoJade @livjojade Participant
Summary

This topic contains 3 replies,
has 2 voices, and was last updated by robertogozzi
2 years, 6 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 06/28/2023
Status: Active
Attachments: 4 files
Logo Logo
Loading...