Discussions
»
Special Interest Groups
»
Advanced Coding Techniques
»
Enhanced System Tester - Executing Orders At A Specific Price
Rank: Newbie
Groups: Registered, Registered Users, Subscribers Joined: 7/28/2007(UTC) Posts: 4
|
Is it possible to execute buy/sell/short/cover trades in the system tester using a specific (exact) price entry? I am trying to execute trades on the same (weekly) bar as a generated signal, but I cannot get the system tester to use anything other than the O/H/L/C on the signal bar. Thanks!
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 7/25/2005(UTC) Posts: 1,042
Was thanked: 57 time(s) in 54 post(s)
|
Ironcondor
Yes it is possible (for the most part) to execute trades at a specific price other than OHLC in any timeframe. The calculated trade price must be within the H-L range, and problems can occur at extreme prices (HIGH or LOW) where it seems that calculated prices can appear to the EST to be (fractionally) outside of the H-L range. From what I've observed I think this situation may be caused by differences in precision between MS and the EST. Whatever the reason, there is a workaround.
One problem that cannot be overcome when working with weekly data is that of EOD opening gaps. An entry price calculated for a weekly bar would be impossible to trade if that price fell within an EOD gap (the gap between the close of one EOD bar and the open of the next EOD bar).
The EST Price windows work well when using the binary signal for the main window (Buy Order formula window for example) and multiplying that binary signal by the price calculation. Of course this means that you'll have more code to fit into the Price window, and that can be a challenge given the limited space available. When the price code is developed as an indicator this can be called as an Fml() to conserve space. It's not so easy to conserve space in the Order windows, particularly when using optimization.
Be aware that the function button beside the Limit or Stop Price line window opens a more useful price code window, so you don't have to fit the price code all into one line.
Roy
MetaStock Tips & Tools
|
|
|
|
Rank: Newbie
Groups: Registered, Registered Users, Subscribers Joined: 7/28/2007(UTC) Posts: 4
|
Roy:
Thanks for the info...everything is working great!
|
|
|
|
Rank: Newbie
Groups: Registered, Registered Users Joined: 6/6/2008(UTC) Posts: 9
|
The EST help says: "Buy/Sell Sign Limit – The order seeks the best price available
above or below (depending on the Order Type) a given limit price."
Is it possible to set EST to buy at the price and not to seek the best price?
By the way, how can it seek the best price?
|
|
|
|
Rank: Advanced Member
Groups: Registered, Registered Users, Subscribers Joined: 7/25/2005(UTC) Posts: 1,042
Was thanked: 57 time(s) in 54 post(s)
|
Hi andwilson
Yes it is possible to set an actual price. Your Price event formula should generate a signal that coincides with the Buy event signal. A one-bar spike from zero to the required price works best for me. You can actually duplicate the price signal and use it as the Buy signal too. As long as the Buy signal is a positive value it will be treated as a TRUE.
Your price signal must be within the H/L range of the bar the trade occurs on. However, if you’re using a calculated price that is equal to H or L it pays to shave a tiny fraction off the price (up or down as required) so that the EST doesn’t test a calculated price of $23.50 against a HIGH of $23.50 (for example) and decide that your calculated price is higher than the real HIGH. This appears to be a precision error of some kind and its effect is to cancel trades that looked good-to-go. Define your price and then add the modifier below to it. This will make virtually no difference to trade results for stocks but the fraction used might be too course if you are trying to test FX.
TradePrice := your definition ;
Min(H-0.0001,Max(L+0.0001,TradePrice);
Any delays to buying and selling should (must) be incorporated in your code and not use EST tick boxes or simulation settings. If you’re calculating a price for trading on the next bar then signal the trade on the next bar after testing that the price is within the H/L Range. Give consideration to the OPEN too. It might meet your trade conditions without the price touching or crossing through your intended trade price.
I’ve made no assumptions about your trading intentions or coding skill level but have just tried to pass on what I know does and doesn’t work.
As for “the best price”, my mates across the ditch would say to w[censored]ver wrote that – “Ya dreamin’ mate”.
Regards
Roy
|
|
|
|
Rank: Newbie
Groups: Registered, Registered Users Joined: 6/6/2008(UTC) Posts: 9
|
Thanks for your fast support.
I'm not sure if it is a problem with my formula or if EST is somehow looking for the best price as the manual describes.
Anyway, EST results shows that it is selling at higher prices then it was suppose too.
I will recheck my formula to see if I can find the error, otherwise I will bother you again.
Thanks again
Anderson
|
|
|
|
Users browsing this topic |
Guest (Hidden)
|
Discussions
»
Special Interest Groups
»
Advanced Coding Techniques
»
Enhanced System Tester - Executing Orders At A Specific Price
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.