Hi
I tried to write this earlier but I am not sure that was posted or not.
Does any know if there is any code that will allow the system to open the trade only when there is not more than 1 or 2 points difference in the spread?
As trading with Dax night time spread goes around 5 points and in the day it’s only 1 point.
Can’t you simply restrict the trading hours?
defparam flatbefore=090000
defparam flatafter=173000
this should do it for the dax. You will of course have to adapt this to your time zone.
Thanks for your repose Despair.
i have tried this by changing the different time but still i get eroor (THis variable is not used in the code:timeenterbefore).
i just don’t want system to be flate before or after particular time. but if i change this time code below system doesn’t take any trade.
i need help system not to take any new trade before 4pm australian time and after 3.30am
// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
// Prevents the system from creating new orders to enter the market or increase position size before the specified time
noEntryBeforeTime = 160000
timeEnterBefore = time >= noEntryBeforeTime
// Prevents the system from placing new orders to enter the market or increase position size after the specified time
noEntryAfterTime = 033000
timeEnterAfter = time < noEntryAfterTime
I’ve been told that PRT doesn’t account for spread, only trading at the mid price so you can’t code anything for it except what you’re trying to do with trade times. I guess if you had a profit target you could lower it during out of hour markets to improve reliability.
Note you have: cumulativeorders = false // change to True to add positions
Dear David, i have tried your comment as well but looks like nothing is working.
I hope there is any error or mistake that I am unable to resolve I have written the full code below that has an error.
This is error below
syntax error:
this variable is not used in the code:timeenterbefore
this variable is not used in the code:timeenterafter.
I apply this code below.
// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
// Prevents the system from creating new orders to enter the market or increase position size before the specified time
noEntryBeforeTime = 160000
timeEnterBefore = time >= noEntryBeforeTime
// Prevents the system from placing new orders to enter the market or increase position size after the specified time
noEntryAfterTime = 235900
timeEnterAfter = time < noEntryAfterTime
// Conditions to enter long positions
indicator1 = RSI[14](close)
c1 = (indicator1 < 23)
IF c1 THEN
BUY 1 CONTRACT AT MARKET
ENDIF
// Conditions to enter short positions
indicator2 = RSI[14](close)
c2 = (indicator2 >= 98)
IF c2 THEN
SELLSHORT 1 CONTRACT AT MARKET
ENDIF
SET STOP PLOSS 30
SET TARGET PPROFIT 10
I want system not to place new trades before 4 pm Australian time and not new enter in new trade after 2:30 am Australian time.
@everyone
PLEASE, use the “Insert PRT code” button when you copy/paste codes from your platform. Thank you! 😀
>> For clarity of messages on ProRealCode’s forums, please use the “insert code PRT” button to separate the text of the code part! Thank you! <<