zoglchaim:
i need a script that executes on the chart to make a pending order with the price = SMA or SMA-10 pips or whatever
i need a script that executes on the chart to make a pending order with the price = SMA or SMA-10 pips or whatever
i got the code and modified it a bit and it stoped working
please tell me whats wrong
You have 2 semicolons missing: after MA variable declaration and after MA initialization. The constant 'null' should be 'NULL' (MQL4 is case sensitive...).
point=MarketInfo(Symbol(),MODE_POINT);Just use the build in variable Point.
OrderSend(Symbol(),OP_SELLSTOP,1.0, MA-10*pointThis won't work on a 5 digit broker.
//++++ These are adjusted for 5 digit brokers. double pips2points, // slippage 3 pips 3=points 30=points pips2dbl; // Stoploss 15 pips 0.0015 0.00150 int Digits.pips; // DoubleToStr(dbl/pips2dbl, Digits.pips) int init() { if (Digits == 5 || Digits == 3) { // Adjust for five (5) digit brokers. pips2dbl = Point*10; pips2points = 10; Digits.pips = 1; } else { pips2dbl = Point; pips2points = 1; Digits.pips = 0; } //... external int tenPips = 10; OrderSend(Symbol(),OP_SELLSTOP,1.0, MA-tenPips*pips2points //...
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
i got the code and modified it a bit and it stoped working
please tell me whats wrong
int start()
{int ticket,expiration;
double point;
double MA
//----
point=MarketInfo(Symbol(),MODE_POINT);
MA= iMA(null,0,20,0,MODE_SMA,PRICE_CLOSE,0)
expiration=CurTime()+PERIOD_D1*60;
//----
while(true)
{
ticket=OrderSend(Symbol(),OP_SELLSTOP,1.0, MA-10*point,0,0,0,"some comment",16384,expiration,Green);
if(ticket<=0) Print("Error = ",GetLastError());
else { Print("ticket = ",ticket); break; }
//---- 10 seconds wait
Sleep(10000);
}
//----
return(0);
}