Dimka-novitsek: Sorry, I can't follow the link, it's not working for me.
int OrdersHistoryTotal(
)
Returns the number of closed positions and deleted orders in the history of the current account, loaded in the client terminal. The size of history list depends on current settings of "Account history" tab of the terminal.
Example:
// retrieving info from trade history int i,accTotal=OrdersHistoryTotal(); for(i=0;i<accTotal;i++) { //---- check selection result if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==false) { Print("Error accessing the history base (",GetLastError(),")"); break; } // work with order ... }
Can you tell me how to correctly specify in the condition the name of the instrument of the already open order? If an order EURUSD_bay is open, then EURJPY_sell should be opened. I think we have something wrong here. If we remove OrderSymbol()=="EURUSD", the order will open, but to open the third order, we still have to solve this problem.
Can someone please advise me how to write a code that would make deals at a certain time. I looked at the FAQ and did not understand anything. I am a programmer, but I am in direct conflict with this language.
I want to show in details what I should do every day at 8:00 am to grab an hour bar and open pending orders from it. To close the pending orders it is necessary either by expiry of time or by TP. and again at 8-00 to take a bar, etc. The code below. This is a problem with the first deal that works clearly according to the criteria, and then I get something for nothing. If it is not difficult please help....
Can someone please advise me how to write a code that would make deals at a certain time. I looked at the FAQ and did not understand anything. I am a programmer, but I am in direct conflict with the language.
I want to show in details what I should do every day at 8:00 am to grab an hour bar and open pending orders from it. To close the pending orders it is necessary either by expiry of time or by TP. and again at 8-00 to take a bar, etc. The code below. This is a problem with the first deal that works clearly according to the criteria, and then I get something for nothing. If it is not difficult please help....
artmedia70: And what is the criterion for you that a position is on the Bollinger midline?
Thank you very much for your quick response!!!!!!!!!!!!!! The criterion is a standard Bollinger Bands indicator with parameters: period 20, shift 0, deviation 2, Weighted Close(HLCC/4)!!!!!!!
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Sorry, I can't follow the link, it's not working for me.
// retrieving info from trade history int i,accTotal=OrdersHistoryTotal(); for(i=0;i<accTotal;i++) { //---- check selection result if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==false) { Print("Error accessing the history base (",GetLastError(),")"); break; } // work with order ... }Can you tell me how to correctly specify in the condition the name of the instrument of the already open order? If an order EURUSD_bay is open, then EURJPY_sell should be opened. I think we have something wrong here. If we remove OrderSymbol()=="EURUSD", the order will open, but to open the third order, we still have to solve this problem.
Can someone please advise me how to write a code that would make deals at a certain time. I looked at the FAQ and did not understand anything. I am a programmer, but I am in direct conflict with this language.
I want to show in details what I should do every day at 8:00 am to grab an hour bar and open pending orders from it. To close the pending orders it is necessary either by expiry of time or by TP. and again at 8-00 to take a bar, etc. The code below. This is a problem with the first deal that works clearly according to the criteria, and then I get something for nothing. If it is not difficult please help....
Can someone please advise me how to write a code that would make deals at a certain time. I looked at the FAQ and did not understand anything. I am a programmer, but I am in direct conflict with the language.
I want to show in details what I should do every day at 8:00 am to grab an hour bar and open pending orders from it. To close the pending orders it is necessary either by expiry of time or by TP. and again at 8-00 to take a bar, etc. The code below. This is a problem with the first deal that works clearly according to the criteria, and then I get something for nothing. If it is not difficult please help....
h ttps://www.mql5.com/ru/forum/130550
I'm sorry, I've written some nonsense here, if you could show me where I'm completely sheepish.
The poses don't seem to open at all, nothing happens.
//+------------------------------------------------------------------+
//| for avalanche.mq4 |
//| Copyright © 2011, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
extern double stoploss=0; extern double takeprofit=20; extern int otstup=20; extern datetime expiration=0;
//+------------------------------------------------------------------+
//| expert initialisation function |
//+------------------------------------------------------------------+
int init()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialisation function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int tiket,tikett;double volume=0.1;int i=0,R1,R2,A=1 ;double price=PRICE_OPEN;
R1=((PRICE_OPEN- stoploss*Point)*stoploss)/stoploss;R2=((PRICE_OPEN+ stoploss*Point)*stoploss)/stoploss;
int start()
{
//----
OrderSelect()tiket,SELECT_BY_TICKET, MODE_TRADES );
if(OrderSymbol()==Symbol()){
if(OrderMagicNumber( )==1000||OrderMagicNumber( )==2000 ){i=OrdersTotal() ;
if (i<2){
tiket= OrderSend( Symbol(), OP_BUYSTOP, volume*A, price+otstup*Point, Point*3, R1, PRICE_OPEN+takeprofit*Point+otstup, "OP_BUYSTOP", 1000, expiration, Red);
Alert ("OP_BUYSTOP", GetLastError( );
tikett= OrderSend( Symbol(), OP_SELLSTOP, volume*A, price -otstup*Point, Point* 3,R2, PRICE_OPEN-takeprofit*Point-otstup, "OP_SELLSTOP", 2000, expiration,C'0,128,255' );
Alert ("OP_SELLSTOP", GetLastError( );
i=OrdersTotal() ; } } }
//----
return(0);
}
//+------------------------------------------------------------------+
Good people help!!!!!! Need a script to close positions any on Bollinger middle line!!!!! Please!!!!
And what is the criterion for you that a position is on the Bollinger midline?