Click here to Login





                                                   Stop orders execute today vs tomorrow - potential peek-ahead?

  0

0
Kiran
2015-05-10 13:28:29


I have the following 2 systems that are identical, with the difference -
A) one executes today based on last 3 days lookback
B) other executes Stop orders tomorrow based on today's and last 2 days lookback

Questions -
1) A delivers much better performance than B - why is that - can't figure out if/why there's peek-ahead risk in (1)
2) Can i use A for live trading using Quantcast against IB
3) If there is peek-ahead, why does Quatcast offer "execute Today" as an option? What scenarios is it used in?

// A) Execute today ..
BuyPrice(ref(Hhv(high,3),1)+0.1*atr(10), -1);
SellPrice(ref(Llv(low,3),1)-0.1*atr(10), -1);
buy = 1;
sell = 1;
SetSimStop(_StopLoss, _Point, ops0*atr(10), 10);


// B) Execute tomorrow ..
BuyPrice(Hhv(high,3)+0.1*atr(10), -1);
SellPrice(Llv(low,3)-0.1*atr(10), -1);
buy = 1;
sell = 1;
SetSimStop(_StopLoss, _Point, 0.2*atr(10), 10);



Kiran
2015-05-10 20:24:07

  0

Actually, following are the 2 systems (ignore the ones above as they dont have the SetSimTiming commands.
-> Also noticed that the Sell orders in B) are not executing at the correct SellPrice, but at Open, ad sometimes when the bar doesnt even touch the Stop price of Llv(low,2)-0.1*atr(10). Is this a bug? How do i fix this in the Tomorrow system, so that i have the formula-based Sell executing at a Stop price?


// A) Execute today ..
SetSimTiming(_Buy,_Stop,-1);
BuyPrice(ref(Hhv(high,2),1)+0.1*atr(10), 1);
buy=1;

SetSimTiming(_Sell,_Stop,-1);
SellPrice(ref(Llv(low,2),1)-0.1*atr(10), 1);
sell=1;

SetSimStop(_StopLoss, _Point, 0.1*atr(10), 1);

//B) Execute tomorrow ..
SetSimTiming(_Buy,_Stop,0);
BuyPrice(Hhv(high,2)+0.1*atr(10),1);
buy=1;

Optimize("sellPer", 2, 4, 1);
SetSimTiming(_Sell,_Stop,0);
SellPrice(Llv(low,2)-0.1*atr(10), 1);
sell=1;

SetSimStop(_StopLoss, _Point, 0.1*atr(10), 1);





QuantShare
2015-05-11 03:52:02

  0

The first system does have a look-ahead bias since it is using a stop at the current signal bar. The order is supposed to be entered after the bar ends (at the end of the day) and you are executing the stop order before the signal bar is analyzed.

The sell price could be executed on open in case the open price is lower than the stop level.



No more messages
0




Reply:

No html code. URLs turn into links automatically.

Type in the trading objects you want to include: - Add Objects
To add a trading object in your message, type in the object name, select it and then click on "Add Objects"










QuantShare

Trading Items
Stop Trading Based on Your Portfolio Equity Return
Conditional Trailing Stop Exit 2013-10-18
Number of Potential Splits per Trading Day
Detect and Display Potential Splits on a Chart
SafeZone Stop

How-to Lessons
How to execute a script at regular intervals
How to get trading orders from a portfolio programmatically
How to create a volatility-based Stop - Dynamic stop based on the...
How to optimize the stop limit of a trading system
How to set order type of a trading system programmatically

Related Forum Threads
Simulator - Activate stop immediately
Simulator: Different exit orders for different rules, partial exi...
Stop Loss effective only for 1st 2 bar of order ..
to write and execute an Indicator
Place a profit stop through Money management strategy

Blog Posts
Trading orders - Part 2
How to get buy and sell orders for a portfolio based on a trading...
Limit and Market orders
Trading Orders - Part 1
Export Trading Orders from a Portfolio to a File









QuantShare
Product
QuantShare
Features
Create an account
Affiliate Program
Support
Contact Us
Trading Forum
How-to Lessons
Manual
Company
About Us
Privacy
Terms of Use

Copyright © 2024 QuantShare.com
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Google+
Follow us on Google+
RSS Trading Items



Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.