Problem with PSAR
10 replies
MIUFX
10 years ago #112025
Hi, this is my first post in the forum. Thanks for the great software!
However, I have a noobish problem with parabolic SAR, which I’m trying to use as a trigger. I can’t make it take all the trades it is supposed to, and I have no idea why. I have tried the “crosses above/below” functions, and also things like “close[2] > psar [2]” AND “close[1] < psar[1]” meaning close price is first above and then below which should trigger the trade (if other conditions are met).
Here is a foto of the problem, it only takes a couple of trades. Here are no other rules, only IsBarOpen and parabolicSAR[1] crosses above/below close[1] , then take long/short. It does only take like 2 out of 7 when I think the rules are met. Please help if you know what could be wrong. The psar step and max are the same in the chart and EA.
Mark Fric
10 years ago #123980
Hello,
it would help if you’d post your strategy here too.
There’s one more thing to consider – indicators redrawing. What you see in the resulting chart might not be the same as what EA sees as it trades.
Some indicators, especially moving averages and PSAR redraw themselves – it means they recompute their values even few candles back . So if some extreme candle arrives,
it can move PSAR that was before above the candle to below it even backwards.
Try to run your EA test in MT4 in Visual mode and watch if it redraws the PSAR dots or not. If not, then there is most probably some error in strategy logic.
Mark
StrategyQuant architect
MIUFX
10 years ago #123998
Hello Marc,
I watched the visual mode and the PSAR does not seem to repaint after candle closing, but the EA does not take the trades…I put one version of the sqw here so maybe you can see something in it. There are no other rules but the cross-over part in this one.
Thanks for the support!
Mark Fric
10 years ago #124019
Hello,
ok, it seems the problem is not with the signal themselves, but that you want to reverse the position.
Just placing a short order when you have long opened will not reverse the position, you have to close the existing position first.
I’m attaching corrected strategy.
Mark
StrategyQuant architect
MIUFX
10 years ago #124049
Thanks for the effort Marc, but it is still not taking all the trades. It takes about every fifth trade of what it would suppose to. I would like it to trigger a trade every single time when the dots switch above/below. I suppose that there is some repaint issue in the pSAR that I cannot figure out. I took another snapshot where it takes four trades according to the rules and then it doesn’t, can you see something that might be the cause? There the psar options were 0.01step and 0.1max on the EA and on the chart. It does take the trades correctly until it stops, and there is no open trades that would interfere…
Mark Fric
10 years ago #124116
Hello,
the strategy worked in my tests, the only issue is that I had to set LotsDecimals = 1 because my broker doesn’t support microlots.
If it is missing some trades check also teh backtest Journal if you don’t see some error message.
Mark
StrategyQuant architect
MIUFX
10 years ago #124255
Hi,
I did some other things for a while but I’m still working on this. I’ve tried all I know at the moment, but i doesn’t take the trades. But yes, the journal says ordersend error 138 a lot, but I can’t figure why and how to deal with that? Any more advise? I attach the newest tryout here with picture. It is supposed to use PSAR as Support/resistance depending on MACD position ( 0). This is originally jimask’s psar_OA.sqw file that I tried to adjust for me but I still get the same errors. I don’t try to take long rides, I consider this kind of a swing approach and I think psar works better in “opposite” direction. Can you(anyone) please check again if there is something wrong?
Mark Fric
10 years ago #124265
Hi,
I tested this EA and it works, at least in backtest. It takes trades as it should.
error 138 is requote, there’s nothing you can do with that except changing the broker. But the EA should be able to handle that, it tries to place order few times when there is a requote.
What exactly problem do you have with the strategy? That it trades but misses some trades? Or it doesn’t trade at all?
Have you tried backtesitng it too?
Mark
StrategyQuant architect
MIUFX
10 years ago #124267
Hi,
it’s weird that it complains about requotes, because my other strategies never don’t. It does take some trades but less than half of what it should, but it seems that at least it tries to take more. I’m doing tickdata backtesting and I’ve had no problems with requotes before… However I can try to settle on what it does now and look if it can be optimized to profitable. I haven’t tested it on demo account so I don’t know if it does something different on that.
Mark Fric
9 years ago #124374
Hello,
does it give you error 138 during backtest?
That’s very strange, there should be no requotes in backtest.
Mark
StrategyQuant architect
krikri
9 years ago #125059
Hi MIUFX,
to avoid error 138 , you must change parameters in MT4:
tools/options and deviation by default = 10 or 15 (in fact 1 or 1.5 pips ).
Try it and say me !!
Krikri
Viewing 10 replies - 1 through 10 (of 10 total)