Is it possible to use the previous bar's Parablic SAR study value as a doLong or doShort entry point? If so, how?
Announcement
Collapse
No announcement yet.
Parabolic Study
Collapse
X
-
JSteensma
Following up on my previous reply.
In addition to what is shown in the example I indicated you may want to include some conditions to check that the Open of the bar that breaches the value of the Parabolic at the prior bar is actually below (if entering a long trade) or above (if entering a short) that value. In that case you would use the value of the Parabolic at the prior bar as the entry price as shown in the example. If instead the Open was above (for a long) or below (for a short) you would then use the Open as the entry price (ie Strategy.MARKET).
These additional conditions would ensure that the results of a backtest are realistic in those instances where a bar does not actually cross the Parabolic but gaps above/below it.
Alex
Comment
-
Thanks heaps for that Alex, it really helped. I allmost had it. I was trying to do it with a "Limit" rather than a "Stop" and I had not used -1 at the end of the SAR thing.
I'm Just wondering if it's possible to remove the First trade or Two from the Back Test? the first trade seems to enter at 0.00. The first 2 or 3 moves on the SAR are not usually very accurate anyway. Also I'm finding that the SAR seems to do this big Arch from 0.00 to the first flip. It only happen when I bring up a new chart, the one that loads on starting up of eSignal is fine. Is there a way around this?
Thanks agian for the help.
JasonLast edited by JSteensma; 04-27-2006, 07:00 AM.
Comment
-
Jason
I'm Just wondering if it's possible to remove the First trade or Two from the Back Test? the first trade seems to enter at 0.00. The first 2 or 3 moves on the SAR are not usually very accurate anyway
If instead you are using the Editor then you would first create a global variable called for example Counter which you set initially to 0 as follows
PHP Code:var Counter = 0;
PHP Code:var study = sar(0.02,0.02,0.2);
PHP Code:if(study.getValue(-1)<low(-1)&&study.getValue(0)>high(0)||
study.getValue(-1)>high(-1)&&study.getValue(0)<low(0)){
Counter++;
}
if(Counter <= 3) return (null);
Once you have done all the above you can now set you normal conditions for trade entries
Hope this helps
Alex
Comment
Comment