Скачать MetaTrader 5

Как я могу определить старейших покупку или продажу - страница 2

Авторизуйтесь или зарегистрируйтесь, чтобы добавить комментарий
pansa
582
pansa  

Hallo,Vinin!

BOLSHOE SPASIBO SA UCHASTIE!

ETOT LINK IMEET SCRIPT -TOLJKO NE RABOTAET

FUNCTIJA-"OrdHstByOpenTime" samodeljnaja

NEGDE VSJATJ!

WOT NASHOL v INETE

MOSHET KTO SMOGET PRIMENITJ

pansa


datetime oldest = 0;

int oldest_ticket = -1;

//Usual selecting loop and stuff

if(OrderOpenTime() < oldest || oldest == 0){oldest = OrderOpenTime(); oldest_ticket = OrderTicket();}

//Outside the loop

if(oldest_ticket != -1){ OrderClose(...); /* Or whatever else you wanna do to the oldest order*/}
//+------------------------------------------------------------------+

pansa
582
pansa  

Script sakroi samyi staryi order JESTJ-on lezhit first in LISTe

//+------------------------------------------------------------------+


//| close.mq4 |
//| Copyright © 2004, MetaQuotes Software Corp. |
//| http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2004, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net/"
#property show_confirm

//+------------------------------------------------------------------+
//| script "close first market order if it is first in the list" |
//+------------------------------------------------------------------+
int start()
{
bool result; double price; int cmd,error; //----
if(OrderSelect(0,SELECT_BY_POS,MODE_TRADES))
{
cmd=OrderType(); //---- first order is buy or sell
if(cmd==OP_BUY || cmd==OP_SELL)
{
while(true)
{
if(cmd==OP_BUY) price=Bid; else price=Ask; result=OrderClose(OrderTicket(),OrderLots(),price,3,CLR_NONE); if(result!=TRUE) { error=GetLastError(); Print("LastError = ",error); }
else error=0; if(error==135) RefreshRates(); else break; }
}
}
else Print( "Error when order select ", GetLastError()); //----
return(0); }
//+------------------------------------------------------------------+ript-close oldest JESTJ nasyvaetsja"Close" ot 2004

12
Авторизуйтесь или зарегистрируйтесь, чтобы добавить комментарий