Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 94
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
artmedia70
Going back to my rams, regarding closing a position on price crossing an indicator line. I think the error is in this function
if(Volume[0]>1) return;
I read in the tutorial that instead of counting ticks we can open (close) a position at appearing of bars. Is it possible? If so, can you give me a hint how to program it for my situation.
artmedia70
Going back to my rams, regarding closing a position on price crossing an indicator line. I think the error is in this function
if(Volume[0]>1) return;
I read in the tutorial that instead of counting ticks we can open (close) a position at appearing of bars. Is it possible? If so, can you send us a hint on how to program it for my situation.
Maybe it will be useful:
The function returns true when a new bar appears on M15
Please advise!!!
I am writing pending orders at a certain time
{
Define open time
}
if ((condition)==true)//
{
OrderSend ( OP_BUYSTOPP, parameters);// open a pending BuyStop order
OrderSend ( OP_SELLSTOP, parameters);// open a pending SellStop order
}
I think I wrote the time correctly; it detect it but for some reason, it opens either Sell Stop or Buy Stop and doesn't open two orders at once. I try to open two pending orders of different types (Bistop and Sellstop) at the same time and one by one. The question seems to be primitive, please help for dummies.)
To paste the code correctly here, click on SRC first and then copy the code there.
If I understood you correctly, at a certain point in time I need to open one OP_BUYSTOP and one OP_SELLSTOP ? Is it acceptable to have any other pending orders at this moment? For example, there are pending orders, but we have to delete the old ones before we open the new ones?
This error refers to graphical objects, not orders
.
Good evening, Victor! Strange, the pending order is not an object! Maybe you have some object that should have already been deleted, but wasn't!
Good afternoon, Boris! The Expert Advisor does not create objects. This error comes from the function that places a pending order. Here is the version of the function (for the tester):
bool OpenPendingBuy(double lot, double price) { int g_ticket = -1; double OOP = price + i_distanceFromLastPos * pt; if (OOP > Ask) { fCheck_ValidPendingOOP(Symbol(), OP_BUYSTOP, OOP); g_ticket = OrderSend(Symbol(), OP_BUYSTOP, lot, ND(OOP), 30, 0, 0, NULL, i_magic, 0, CLR_NONE); } if (g_ticket > 0) { return (true); } else pr ("OpenPendingBuy(): Ордер послать не удалось " + GetLastError()); return (false); }
If no order has been placed, this means that a block has triggered:
This is the block that reports the error.
Has anyone understood the logic?
Since there's no answer to the question, here's a function that will return the ticket of the last order set:
Thank you!!! just what I need
Exactly! The error concerns objects, but I have no objects in this EA...
Good afternoon, Boris! The Expert Advisor does not create objects. This error comes from the function that places a pending order. Here is the version of the function (for the tester):
If the order has not been placed, this means that a block has triggered:
This is the block that reports the error.
Has anyone understood the logic?
So, check your error check? There must be something glitchy there!
Heh)) What's there to glitch about Boris? It's all transparent...
pr is a print function. And the error, it's already a standard constant. Logically, it's unacceptable to be that way at all. If you still have a suspicion about the pr function, here it is:
Is the lot normalized? Well and check the price.
Are i_magic, pt, i_distanceFromLastPos global?
i_magic, pt, i_distanceFromLastPos are global?
Yes. Variables with i_ are input variables (from the word intut, which can be changed by the user...), and pt is a global variable too, which is visible everywhere...
Is the lot normalized? Well and check the price.
No, the lot has not been normalised. Never encountered it in the tester... And what does lot have to do with the object (error 4200)?
I occasionally, but not constantly, get a 4200 error when I set a pending order. According to the documentation this error means that the object already exists:
It turns out that an order of this type is already in the market when the pending order is sent?