|
umair
2013-03-28 09:51:13
|
|
Hi, is it possible to do a EOD simulation but use a intraday stoploss profit target. Meaning is it possible to set up stop losses in EOD simulation that have access to intraday data? This would be very helpful because I'm finding my self creating all these variables that are based on EOD data but the actual application for these variables is in intraday data. So I keep having to switch to different timeframe a
Example: setting = EOD simulation
A = xvariable > 5;
B = buy at open if a is true
Buy= b
Exit= hour() == 15; (again accessing intraday values while being in EOD simulation)
stoploss at 5 basis points (again would have to be able to access intraday values)
Thanks QS geniuses!!
|
|
|
|
QuantShare
2013-03-28 11:03:11
0
|
|
Hi,
In an EOD simulation, using the variable "hour()" will always return "0".
If you want to exit at the end of the day, simply put:
sell = 1;
Regarding stoploss, by setting a 5 basis points, the simulator will initiate the stop loss if the price decreases by 5 points.
By default, it will create the order after the stop loss is initiated.
However, you can exit the position at the exact price, by updating the trading system, selecting "Settings -> Capital" then checking "Activate stop immediately".
|
|
|
|
umair
2013-03-28 19:28:19
0
|
|
sell = 1; does not exit EOD. it creates the signal to exit and then exits the next day at open. any way to make it exit the day the signal is created?
side question, is there a way to execute all orders immediately rather than waiting for the next bar?
the stoploss suggestion you gave actually works. I'm just curious where the prices are coming from?
''active stop immediately'' is that just assuming that if ''low'' of the daily bar is less than stoploss, execute a ''immediate'' stop at stoploss price using a formula...for example (buyprice-(buyprice*.005)) OR is the 'active stop immediately'' feature actually checking intraday quotes to get the prices??
|
|
|
|
QuantShare
2013-03-28 21:04:49
0
|
|
any way to make it exit the day the signal is created?
You just have to change the order type:
SetSimTiming(_Sell, _Close, -1);
Set sell order to execute at close price of today (-1).
The ''active stop immediately'' doesn't use intraday data. The order is executed at stop limit if this value is higher than day's low (as you said).
|
|
|
|
umair
2013-03-29 10:55:02
0
|
|
Ok, excellent the setsimtiming works. i looked around but couldnt find a ''how to'' or more of an explanation for this variable. can you please explain? for me strategy i was able to get it to work
// Buy rules
a = Dropper(close,open,0,-0.005,-0.01,10,20,30);
buy = a > 100;
// Sell rules
sell = ref(close,-1);
SetSimTiming(_Buy, _Open, 0);
SetSimTiming(_Sell, _Close, -1);
but i had to use both the setsimtiming for buy and close to get the system to sell at EOD ( i looked copied a system you guys have created http://www.quantshare.com/item-1030-trading-system-based-on-the-previous-week-spy-return#)
am i doing this correctly?
|
|
|
|
QuantShare
2013-03-29 12:39:32
0
|
|
Yes, this will buy at the open of tomorrow and sell at the close of today.
If you put "1" in the third variable then it will buy at the open of tomorrow + 1 (day).
|
|
|
|
umair
2013-03-29 22:35:34
0
|
|
Ok that's great to know.
One more question.
If I put a limit profit order and a limit stoploss on EOD simulation, how will the simulation know which one came first?
In other words, does the "activate stop immediately" also work for limit profit targets? And if it does, does the simulator know if the stop hit first or if the profit target hit first in a EOD simulation
|
|
|
|
QuantShare
2013-03-30 10:37:15
0
|
|
The "Activate stop immediately" also work for profit and trailing stops.
The simulation will not know if the stop loss or stop profit came first. It execute stops in the following order:
Stop Loss
Profit Stop
Trailing Stop
N-Bar Stop
|
|
|
|
giotrader
2017-07-15 16:00:46
0
|
|
How can I do the opposite of what is told in this post, that is in an intraday strategy how can I set a stop that closes a position at the close of the day following the day the position was opened? All positions were not opened at the same time, so I don't think an n-bar stop would work.
|
|
|
|
QuantShare
2017-07-16 08:00:46
0
|
|
sell = day() != ref(day(), -1);
|
|
|
|
giotrader
2017-07-17 08:26:27
0
|
|
Thanks quantshare..
|
|
|
|