what is the code for identify is trade rn or not?

 

hi everybody,

I develop little ea. I need to identify at the movement trade run or not? so what is the code for identify it? I grate appreciate who can help me to this


Thanks.

 

It is not clear what you mean.

If you mean "was the order placed?" then test the OrderSend to see if it was successful.

To check what orders are present then loop through all orders using OrderSelect

 
Perhaps he means a Pending Order being activated ? if so, first select it using OrderSelect() then check it's type using OrderType() . . .
 

hi Simon and dabbler you correct,

i want to identify is pending order being activated or not. I try those function to test it. Thanks lot for both of you. If you can give simple sample for it. mean time I try it.

 
yadgayan:

hi Simon and dabbler you correct,

i want to identify is pending order being activated or not. I try those function to test it. Thanks lot for both of you. If you can give simple sample for it. mean time I try it.

There are lots of code sample already posted covering selecting orders by type . . . use the search function at the top right of the page and you will find what you need.

Important to remember . . . if you are deleting/closing orders you MUST count down in a loop.

 
yadgayan:

hi Simon and dabbler you correct,

i want to identify is pending order being activated or not. I try those function to test it. Thanks lot for both of you. If you can give simple sample for it. mean time I try it.

Let's suppose you have two pending orders relevant to the EA in question. This could be either by just trading one method in this account or by using a unique magic number for this EA and when you OrderSelect you neglect any orders which have the wrong magic number. You cannot spot that an order has changed from a pending order to a market order by means of OrdersTotal because the total hasn't changed. You can go through all current orders and see how many are pending and how many are market orders and note the change in counts from the last time you did it.

The point is if you think through what you want to do carefully the code will practically write itself.

 

hi,

my logic is like this..

i use 1 hr chart

read tick and get high and low value at 58 minutes.

x= high value

y = low value

z = current price

i put buy stop and sell stop at x and y. and give tp = 5..

there conditions.

if new hour not hit x and y delete trade

if price hit x or y and one trade go to tp and if remain trade(sell or buy stop) delete it.

if price hit x,y and not go to tp. then wait till one trade go to tp. then close other trade.

please can you advice me is this logic is success or any other way to develop it.



 
yadgayan:


please can you advice me is this logic is success or any other way to develop it.

You need to code it, debug it, and then test it with a few years of good data to see if it is worth pursuing further.
 
how i debug it? I try to debug . but how i do it?
 
yadgayan:
how i debug it? I try to debug . but how i do it?
You run it in the Strategy Tester and see what it does, you can also add Print statements to send variable values to the log or use Comment to send them to screen.
 
RaptorUK:
You run it in the Strategy Tester and see what it does, you can also add Print statements to send variable values to the log or use Comment to send them to screen.

ok. does Strategy Tester is 100% sure? I did some tests, but some time it not trade. but it can's be. because my function should work. if i run in real it work. so how i solve this issue?

Reason: