I am using the iSAR-Function in my EA. It is returning an accurate result.
When, however, I try to add something, it returns 0:
double SAR_C = iSAR(NULL,0,0.02,0.2,1)+0.00005;
Print("SAR_C: "+SAR_C);
This prints "SAR_C: 0.00000". Why is this? How can I prevent this/add something to the iSAR-Result?
I obtain this result on EURUSD H1:
2013.06.07 17:50:49 testing EURUSD,H1: SAR_C: 1.32855000
On what chart/timeframe did you run your code ?
That's strange. I am using this in the strategy tester on M5, EURUSD.
Edit: Everything else seems to work perfectly.
That's strange. I am using this in the strategy tester on M5, EURUSD.
Edit: Everything else seems to work perfectly.
Yes, iSAR(NULL,0,0.02,0.2,1) was originally (still is in another part) appointed to another variable that's giving out the right result. When I use that variable in the EA, everything works out, but not when I try to add (or substract) something.
Yes, iSAR(NULL,0,0.02,0.2,1) was originally (still is in another part) appointed to another variable that's giving out the right result. When I use that variable in the EA, everything works out, but not when I try to add (or substract) something.
Sure. This is the relevant part:
double SAR_Current = iSAR(NULL,0,0.02,0.2,1); double SAR_C = iSAR(NULL,0,0.02,0.2,1)+0.00005; Print("SAR_Current: "+SAR_Current+" SAR_C: "+SAR_C);
This prints at one point:
SAR_Current: 1.33079513 SAR_C: 0.000000000 (give or take a couple of 00).
Same, when I have SAR_Current in SAR_C instead of the iSAR-function..
Are you sure you don't have any modification of SAR_C in your original code between these 2 lines
double SAR_C = iSAR(NULL,0,0.02,0.2,1)+0.00005; Print("SAR_Current: "+SAR_Current+" SAR_C: "+SAR_C);
Sure. This is the relevant part:
This prints at one point:
SAR_Current: 1.33079513 SAR_C: 0.000000000 (give or take a couple of 00).
Same, when I have SAR_Current in SAR_C instead of the iSAR-function..
Complete code:
double SAR_Current = iSAR(NULL,0,0.02,0.2,1); double SAR_C = iSAR(NULL,0,0.02,0.2,1)+0.00005; if(IsNewCandle_Current()) { Print("SAR_Current: "+SAR_Current+" SAR_C: "+SAR_C); if(OrderStopLoss()>SAR_Current && SAR_Current!=0) { Print("SAR_Current < Stop Loss"); OrderModify(OrderTicket(),OrderOpenPrice(),SAR_Current,OrderTakeProfit(),0,CLR_NONE); } }
This is the output:
2013.06.07 18:25:34 2011.01.05 01:10 My EA 5 EURUSD,M5: SAR_Current: 1.33131122 SAR_C: 0.00000000 2013.06.07 18:25:30 2011.01.05 01:05 My EA 5 EURUSD,M5: SAR_Current: 1.33108859 SAR_C: 0.00000000 2013.06.07 18:25:26 2011.01.05 01:00 My EA 5 EURUSD,M5: SAR_Current: 1.33093371 SAR_C: 0.00000000 2013.06.07 18:25:23 2011.01.05 00:55 My EA 5 EURUSD,M5: SAR_Current: 1.33079513 SAR_C: 0.00000000 2013.06.07 18:25:22 2011.01.05 00:50 My EA 5 EURUSD,M5: SAR_Current: 1.33067681 SAR_C: 0.00000000 2013.06.07 18:25:21 2011.01.05 00:45 My EA 5 EURUSD,M5: SAR_Current: 1.33058610 SAR_C: 0.00000000
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I am using the iSAR-Function in my EA. It is returning an accurate result.
When, however, I try to add something, it returns 0:
double SAR_C = iSAR(NULL,0,0.02,0.2,1)+0.00005;
Print("SAR_C: "+SAR_C);
This prints "SAR_C: 0.00000". Why is this? How can I prevent this/add something to the iSAR-Result?