[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 285

 
Cmu4:

You can do it manually. Right-click and then... :)

You can apply a script or an Expert Advisor. Which do you prefer? XD

I'm writing an EA that places pending orders and works on a channel break..can you help?
 
Parn25:
I'm writing an EA that puts pending orders and works on a channel break...can you help?

Set orders and catch trades, as soon as the pendent becomes a market maker delete all pending orders for that symbol/magic. Just as a refresher http://www.kimiv.ru/index.php?option=com_remository&Itemid=13&func=fileinfo&id=36

 
splxgf:

Set orders and catch trades, as soon as the pendent becomes a market maker delete all pending orders for that symbol/magic. For the background http://www.kimiv.ru/index.php?option=com_remository&Itemid=13&func=fileinfo&id=36

I have a problem how to select it with OrderSelect function and then delete it with OrderDelet function..thanks for the link I will read it.
 

It is better to look through a textbook, and Kim has many functions.

Here is a rough plan: loop all orders through ordertotal and orderselect, make sure the symbol coincides with the current one and check the magik (if needed). Then we should look at the order type, if it is a market order, increment the number of market orders, if it is a pending order, increment pending orders. After that there will be two numbers, let's say if there is one pending then delete all the pending orders.

 
splxgf:

It is better to look through a textbook, and Kim has many functions.

Here is a rough plan: loop all orders through ordertotal and orderselect, make sure the symbol coincides with the current one and check the magik (if needed). Then we should look at the order type, if it is a market order, increment the number of market orders, if it is a pending order, increment pending orders. After that there will be two numbers, let's say if there is one pending then delete all the pending orders.

I think I'm getting somewhere. Thanks for the link, it really helped)))
 
rusa:

The code is two parts. .This is my expert. Please have a look at it.

Here you go. If you have any more questions, please show me a screenshot and the parameters. I have seen your TOR in your job on the development of this Expert Advisor. What you have done with it afterwards, only you know. Good luck!
Files:
rusa_v4.zip  4 kb
 

This is the first time I've created arrays and I do it like this

extern string sym1="AUDJPY";
extern string sym2="AUDUSD";
extern string sym3="EURJPY";
extern string sym4="EURUSD";
extern string sym5="GBPJPY";
extern string sym6="GBPUSD";
extern string sym7="NZDUSD";
extern string sym8="USDCAD";


//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   string sym[8] = {sym1, sym2, sym3, sym4, sym5, sym6, sym7, sym8};

//----
   return(0);
  }

and it gives me an error.

'}' - comma or semicolon expected

What's wrong?

 
dmmikl86:

This is the first time I've created arrays and I do it like this

and it gives me an error.

What's wrong?


Arrays can only be initialised with constants.
 
dmmikl86:

This is the first time I've created arrays and I do it like this

and it gives me an error.

What's wrong?

https://book.mql4.com/ru/variables/arrays. Custom arrays. stringarray.mq4
 
ZZZEROXXX:

From the moving average, take CalculateCurrentOrders(Symbol()), it returns values = number of open orders, filtered by symbol and magic, with sign = direction of transaction: for example -1 means 1 order in sale. If needed, use MathAbs() to ignore the sign.

From the above code, take the trailing stop:

// check for trailing stop - here, there are even comments.

if(TrailingStop>0) { ... }, it is in 2 places - for buying and selling. Everything is simple. Or, you can use ready-made functions of Igor Kim's. There is a special colour here. They are more universal and correct for real trading, but also a little more difficult to understand for a beginner. If you have a good faith in the new version, you will get a better trading robot.

p.s. For debugging, use Print(), it helps a lot.


Please help a beginner. How to write this code section:

Check market orders and if there are no market orders for our financial instrument, then buy?

I can't do it!!! Help... Maybe someone has a ready code fragment?

Reason: