[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 387
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
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?