I have coded a strategy in which the opening of a trade is dependent on the whether it crosses the opening price of the previous trade or not. I have used the IMessage method. But what should I do about the first trade to be taken by the strategy? It will not have any previous trade. I want to open it normally and then the rest of the trades should be dependent on the previous trades.
I have put the IMessage method before the onTick method in the code. But the historical testing results of the strategy are the same as the one without the IMessage code. I am attaching the strategy. Kindly help.
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on
this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control
on their content. Anyone accessing this webpage and downloading or otherwise making use of any document,
data or information found on this webpage shall do it on his/her own risks without any recourse against
Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from
the use and/or reliance on any document, data or information found on this webpage.
I have corrected a mistake that I had made in the above strategy by submitting order opening in IMessage method when it should have been in the onBar method. But even after submitting order opening in onBar method, there is an error regarding the fetching of the opening price of the last order closed.
I have fetched the opening price of the last order closed in the IMessage method but I don't know how to fetch it in the onBar method while submitting a new order opening. The following error is shown in compilation.
2012-10-30 14:10:00 ---------- 2012-10-30 14:10:00 lastorderclosed cannot be resolved 2012-10-30 14:10:00 ^^^^^^^^^^^^^^^ 2012-10-30 14:10:00 if (tick1.getBid() < lastorderclosed.getOpenPrice() && prevBar.getOpen() > sma && prevBar.getClose() < sma && order == null) 2012-10-30 14:10:00 2. ERROR in C:\Users\Mankind\AppData\Local\Temp\jfxide\tmp\compile\SMASimpleStrategymodify3.java (at line 105) 2012-10-30 14:10:00 ---------- 2012-10-30 14:10:00 lastorderclosed cannot be resolved 2012-10-30 14:10:00 ^^^^^^^^^^^^^^^ 2012-10-30 14:10:00 if (tick1.getBid() > lastorderclosed.getOpenPrice() && prevBar.getOpen() < sma && prevBar.getClose() > sma && order == null) 2012-10-30 14:10:00 1. ERROR in C:\Users\Mankind\AppData\Local\Temp\jfxide\tmp\compile\SMASimpleStrategymodify3.java (at line 100) 2012-10-30 14:10:00 ----------
Plz tell me how to do it. I am attaching the corrected strategy.
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on
this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control
on their content. Anyone accessing this webpage and downloading or otherwise making use of any document,
data or information found on this webpage shall do it on his/her own risks without any recourse against
Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from
the use and/or reliance on any document, data or information found on this webpage.
In order to avoid such errors before compilation and receive correction advice consider using an IDE for writing your strategies e.g. Eclipse or NetBeans.