#property strict #property show_inputs extern double gap = 0.00002; double ask() { static double priceGap = 0; priceGap += gap; return priceGap; } void OnStart() { for ( int count = 0; count < 10; count++ ) { OrderSend(Symbol(), OP_BUYLIMIT, 0.01, Ask - ask(), 3, Bid - 100000*Point, Bid + 1000 * Point); } }
error code 130 for the first 4 iterations. even after reducing the stop/loss argument down to, Bid - 1000 * Point , i'm still getting the same error. I would prefer not to have a stop/loss at all which is why I set it so far away in the first place.
I changed the gap input to 0.0001 and now it is working. I guess the first 4 orders were placed to close to the market price for this broker. Thanks for the tip GumRai.
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
Hello,
I was hoping someone could help me. This loop will only iterate 6 times when it should iterate 10.
#property copyright "Copyright 2014, MetaQuotes Software Corp."
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
#property show_inputs
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
extern double gap = 0.00002;
double ask()
{
static double priceGap = 0;
priceGap += gap;
return priceGap;
}
void OnStart()
{
for ( int count = 0; count < 10; count++ )
{
OrderSend(Symbol(), OP_BUYLIMIT, 0.01, Ask - ask(), 3, Bid - 100000*Point, Bid + 1000 * Point);
}
}
It will only open 10 buy limits if i set count to -4
I am using this metatrader through forex.com
this same code works properly when using fxcm and oanda's version of metatrader however i have inconsistent off quote and fifo errors when trying to close the orders.
with forex.com i can close the orders properly but the loop is always 4 iterations shy of what it should be.
this seems bizarre to me.
any help would be much appreciated