Hi,
I found that the trades are not behaving as I wanted it to. Could someone help please?
Attache (and below is a test efs).
This test efs is applied to CL #F using 1 minute interval. Time span must include Jan 02 2007, 9:53am and 3 subsequent bars.
Below is the Formula Output, with the bottom line printed first in time and top line last in time.
11 61.22 61.2
10 61.21 61.19
9 61.2 61.2
doSell is issued at bar 9
61.22 61.2
3 61.27 61.26
2 61.28 61.27
1 61.27 61.27
Attached is the image from Strategy Analyser.
The problems are the following:
1. when a doLong is issued for the nextbar at 9:53am on 1/2/2007 at limit price of 61.21, it entered at the next bar (9:54am) at 61.21 eventhough the next bar's high and low are both 60.20.
2. When a doSell is issued at bar 9 (the bar the the Long order is executed) to exit next bar at limit 61.17, it executed at exactly 61.17 eventhough bar 10's high and low are 61.21 and 61.19.
Did I do something wrong, or have I omitted something here?
William
I found that the trades are not behaving as I wanted it to. Could someone help please?
Attache (and below is a test efs).
PHP Code:
var study = new MAStudy(40, 0, "Close", MAStudy.SIMPLE);
var barcount=0;
function preMain() {
setPriceStudy(true);
setColorPriceBars(true);
}
function main() {
if (year(0)==2007 && month(0)==1 && day(0)==2 && hour(0)==9 && minute(0)==53)
{
debugPrintln(high(0)+" "+low(0));
barcount=getCurrentBarCount();
Strategy.doLong("Re-E", Strategy.LIMIT, Strategy.NEXTBAR, 2, 61.21);
}
if (getCurrentBarCount()>barcount && getCurrentBarCount()<=barcount+3)
{
if (Strategy.isLong())
{
Strategy.doSell("SL", Strategy.LIMIT, Strategy.NEXTBAR, Strategy.ALL, 61.17);
debugPrintln("doSell is issued at bar "+getCurrentBarCount());
}
debugPrintln(getCurrentBarCount()+" "+high(0)+" "+low(0));
}
}
Below is the Formula Output, with the bottom line printed first in time and top line last in time.
11 61.22 61.2
10 61.21 61.19
9 61.2 61.2
doSell is issued at bar 9
61.22 61.2
3 61.27 61.26
2 61.28 61.27
1 61.27 61.27
The problems are the following:
1. when a doLong is issued for the nextbar at 9:53am on 1/2/2007 at limit price of 61.21, it entered at the next bar (9:54am) at 61.21 eventhough the next bar's high and low are both 60.20.
2. When a doSell is issued at bar 9 (the bar the the Long order is executed) to exit next bar at limit 61.17, it executed at exactly 61.17 eventhough bar 10's high and low are 61.21 and 61.19.
Did I do something wrong, or have I omitted something here?
William
Comment