three trades per hour max
Forums › ProRealTime English forum › ProBuilder support › three trades per hour max
- This topic has 16 replies, 4 voices, and was last updated 7 years ago by AutoStrategist.
-
-
04/15/2017 at 7:36 PM #32121
Hello,
I would like my trading system to place no more than 3 trades in any given trading hour.
For example it will be placing trades throughtout the day, but if it places 3 trades during 3-4PM then i wnt it to no place anymore trades until it reaches 5pm
i dont want it to be able to place like 5-1o trades in a short pace of time so i need to limit it to place no more than 3 per hour
IF anyone knows the code to use to do this please let me know
I have some good algorithms that i will happily share with who ever provides me with this code
thanks
04/16/2017 at 10:53 AM #3214404/16/2017 at 2:04 PM #32183Ok no problem ill share some if i get the answer
04/16/2017 at 7:51 PM #32229Isn’t this the same question you asked 4 days ago under ‘Max number of open trades??’
I believe the answer I gave works did you try it?
04/16/2017 at 8:26 PM #32233Yea i trie dbut it didnt work i got an error saying incomplete code
04/16/2017 at 8:57 PM #32237say for example this is my code:
// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated// Prevents the system from placing new orders on specified days of the week
daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0// Conditions to enter long positions
indicator1 = Stochastic[14,3](close)
c1 = (indicator1 CROSSES OVER 70)
indicator2 = Average[200](close)
c2 = (close > indicator2)IF (c1 AND c2) AND not daysForbiddenEntry THEN
BUY 1 PERPOINT AT MARKET
ENDIF// Stops and targets
SET TARGET pPROFIT 10where should i enter the code you sent me to limit the trading to 3 per hour max???
please copy my code and enter the relevant code and paste it back
thanks in advance
04/17/2017 at 8:10 AM #32267Hello. As I can see from your first post you are using a daily timeframe or am I mistaken?
Since our code is tested once at each timeframe we cannot calculate anything on a hourly basis if 1 day TF is used.
if you want to only have 3 trades a hour you need to lower your timeframe to a max of 15 min.
Cheers Kasper
04/17/2017 at 12:18 PM #32292That cose ewas example
Please let me know how to do ot fpr a two minute chart
I am using a 2 min timeframe
Please use the code above and cchange it to two minute timeftame and enter the code to limit trading to three trades per hour max on a twp minute timeframe
Thanks
04/17/2017 at 12:40 PM #32293Hi AlreadyRich,
Seems my original code was not so good (TRADEINDEX counts all transactions) not as straightforward a problem as it first sight appeared.
Attached is some code which I believe does what you want which I have tested on DAX and DJI 2 minute charts. let me know if this works for you.
1 user thanked author for this post.
04/17/2017 at 2:19 PM #32310Hi Rich.
I don’t know it this will work- I cannot find a test where I have 3 trades within one hour, so can you test this?
12345678910111213141516171819202122232425262728293031323334353637383940414243444546// Definition of code parametersDEFPARAM flatafter =220000DEFPARAM flatbefore=080000DEFPARAM CumulateOrders = false // Cumulating positionsDEFPARAM PRELOADBARS = 100// Cumulating positions deactivated// Prevents the system from placing new orders on specified days of the weekdaysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0// Conditions to enter long positionsindicator1 = Stochastic[14,3](close)c1 = (indicator1 CROSSES OVER 70)indicator2 = Average[200](close)c2 = (close > indicator2)OnMarketBarCount=barindex-tradeindexonce CountOfTrades =0once trade =0//once test1=1//if OnMarketBarCount<=30 thenIF OnMarketBarCount[1]<OnMarketBarCount THENCountOfTrades=CountOfTradeselsif not onmarket then//OnMarketBarCount[1]>OnMarketBarCount THENmytime=timeCountOfTrades=CountOfTrades+1endifif mytime+010000<=time and countoftrades<=3 thentrade=1elsif mytime+01000<=time and countoftrades>=3 thentrade=0countoftrades=0endif//endifIF (c1 AND c2) AND not daysForbiddenEntry and CountOfTrades<=3 and trade THENBUY 1 PERPOINT AT MARKETENDIF//graph time COLOURED(0,0,0) AS "time"//graph CountOfTrades COLOURED(0,0,0) AS "CountOfTrades"//graph trade COLOURED(0,0,0) AS "trade"//graph mytime COLOURED(0,0,0) AS "mytime"1 user thanked author for this post.
04/17/2017 at 3:03 PM #32311I see a error- line 32 is missing a 0
1elsif mytime+010000<=time and countoftrades>=3 then04/17/2017 at 3:42 PM #32313thanks – i will test now
04/18/2017 at 12:19 AM #32368the backtest isnt working – i am getting results of no trades
04/18/2017 at 12:27 AM #32371Hi Autostrategist,
your code seems like its on the right track however its still slightly off
can you please create it in the same format as how the simplified creation normally creates its code.. i have pasted my code below…can you please merge the two into one code – so that my below code is set to place no more than 3 trades per hour? thanks in advance
123456789101112131415161718// Definition of code parametersDEFPARAM CumulateOrders = False // Cumulating positions deactivated// Prevents the system from placing new orders on specified days of the weekdaysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0// Conditions to enter long positionsindicator1 = Stochastic[14,3](close)c1 = (indicator1 CROSSES OVER 70)indicator2 = Average[200](close)c2 = (close > indicator2)IF (c1 AND c2) AND not daysForbiddenEntry THENBUY 1 PERPOINT AT MARKETENDIF// Stops and targetsSET TARGET pPROFIT 1004/18/2017 at 7:37 PM #32506Hi Rich,
I took my code and added it in to yours. You are a very brave man if you are running that strategy live, I wish you well with it. You know what they say if something looks too good to be true…
-
AuthorPosts
Find exclusive trading pro-tools on