I do not see why it is not working.
Add some temporary alerts so you can check the return values of the variables. Add some error trapping to the OrderSend() call in case there is something wrong there. The commented out Alert would need adapting for you to use.
Something like this:
Code: Select all
double parabolic = iSAR(_Symbol,_Period,0.02,0.2,0);
double KLine = iStochastic(NULL,0,5,3,3,MODE_SMA,MODE_MAIN,0,0);
double DLine = iStochastic(NULL,0,5,3,3,MODE_SMA,MODE_SIGNAL,0,1);
Alert(parabolic);
Alert(KLine);
Alert(DLine);
RefreshRates();
bool result = OrderSend(_Symbol,OP_BUY,0.1,Ask,3,Ask-50*_Point,Ask+25*_Point,NULL,0,0,Green);
if(!result)
{
int err=GetLastError();
if(err==132)//Market is closed
return;
//Alert(symbol," Buy: Lots ",lot,": Price ",price,": Ask ",ask, ": Stop ", DoubleToStr(stop, digits), ": take ", DoubleToStr(take, digits) );
Alert(symbol," ",WindowExpertName()," order send failed with error(",err,"): ",ErrorDescription(err));
}//if (!result)
Bear in mind that OrdersTotal() applies to all orders on the platform, so the conditional will prevent more trades from being sent even if the trades are on a different pair. You might need a function instead that checks to see that there are no open orders on the chart symbol.
Read the effing manual, ok?
Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.
I still suffer from OCCD. Good thing, really.
Anyone here feeling generous? My paypal account is always in the market for a tiny donation.
[email protected] is the account.
To see The Weekly Roundup of stuff you guys might have missed
Click here
My special thanks to Thomas (tomele) for all the incredible work he does here.