Backtesting :: Migration to Simulated / Real-Time Trading
Backtesting :: Migration to Simulated / Real-Time Trading
Loading saved threads...
PiE · External communityPost link
External question — Quantitative Finance Stack Exchange
Author: PiE
Original post: https://quant.stackexchange.com/questions/44150
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
I am relatively new to backtesting and I want to migrate my system to simulated trading via Amibrokers Interactive Broker's API.
What I have been doing is setting trade delays such that when a
Buy
or
Short
signal occurs, the algorithm buy or short on the next
Open
.
Here is a sample code:
**BuySignal = Cross( Close, MA(Close, 100 ) );
// buy on the next bar
Buy = Ref( BuySignal, -1);
BuyLimitPrice = Ref( Close, -1) * 0.99;
// now we check if limit was hit
Buy = Buy AND L < BuyLimitPrice;
// if Open price is below the limit, then we use Open for entry
BuyPrice = Min( Open, BuyLimitPrice );**
The question is that: When you migrate this to real-time or simulated trading, what price do you use for
Open
?
This is what I am struggling with - there are two options:
a) Use real-time data for the price of the stock (i.e., GetRTData( "Last" ) ) which is the "last" value that the ticker was traded at, or
b) Use the value of
Open
of the stock for that bar, which can be obtained by the system.
Which value is the correct or the best one to use (i.e,
a
or
b
)?
Quote
Report
Post Reply
Quoted from Forex.com.bd-Editorial External question — Quantitative Finance Stack Exchange Author: PiE Source score (net votes, not local likes): 3 Original post: https://quant.stackexchange.com/questions/44150 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. I am relatively new to backtesting and I want to migrate my system to simulated trading via Amibrokers Interactive Broker's API. What I have been doing is setting trade delays such that when a Buy or Short signal occurs, the algorithm buy or short on the next Open . Here is a sample code: **BuySignal = Cross( Close, MA(Close, 100 ) ); // buy on the next bar Buy = Ref( BuySignal, -1); BuyLimitPrice = Ref( Close, -1) * 0.99; // now we check if limit was hit Buy = Buy AND L < BuyLimitPrice; // if Open price is below the limit, then we use Open for entry BuyPrice = Min( Open, BuyLimitPrice );** The question is that: When you migrate this to real-time or simulated trading, what price do you use for Open ? This is what I am struggling with - there are two options: a) Use real-time data for the price of the stock (i.e., GetRTData( "Last" ) ) which is the "last" value that the ticker was traded at, or b) Use the value of Open of the stock for that bar, which can be obtained by the system. Which value is the correct or the best one to use (i.e, a or b )?
Checking account access…