Need help with code about spread
Forums › ProRealTime English forum › ProOrder support › Need help with code about spread
- This topic has 5 replies, 4 voices, and was last updated 7 years ago by Nicolas.
-
-
06/08/2017 at 6:13 PM #37843
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.
06/08/2017 at 6:31 PM #3784606/09/2017 at 8:38 AM #37871Thanks 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 < noEntryAfterTime06/09/2017 at 1:40 PM #37893I’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
06/11/2017 at 10:12 AM #38032Dear 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
ENDIFSET STOP PLOSS 30
SET TARGET PPROFIT 10I 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.
06/11/2017 at 7:01 PM #38079@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! <<
-
AuthorPosts
Find exclusive trading pro-tools on