tradeprice / entryprice
Forums › ProRealTime English forum › ProOrder support › tradeprice / entryprice
- This topic has 3 replies, 2 voices, and was last updated 1 year ago by robertogozzi.
-
-
06/28/2023 at 8:11 PM #216938
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.
06/28/2023 at 11:56 PM #216951Line 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:
1GRAPH indicator207/03/2023 at 3:54 PM #217195Hi 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
08/11/2023 at 5:48 PM #218949You should add PipSize as a multiplier for a, b and c, such as:
1(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?
-
AuthorPosts
Find exclusive trading pro-tools on