PORTFOLIO_EX DEFENDER_1 DESCRIPTION DEFENDER_1 CLIENTS_LIST ALL_CLIENT

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
PORTFOLIO_EX DEFENDER_1.1;
DESCRIPTION DEFENDER_1.1;
CLIENTS_LIST ALL_CLIENTS;
FIRMS_LIST FIRM_ID;
PROGRAM
INSTRUMENT="RIM9"
NEW_GLOBAL("FLAGSTOP",0)
NEW_GLOBAL("FLAGTPROFIT",0)
STOPLOSS=100
TPROFIT=200
N=GET_NUMBER_OF("FUTURES_CLIENT_HOLDINGS")+0
IF N>0
FOR I FROM 0 TO N
IF GET_VALUE (GET_ITEM ("FUTURES_CLIENT_HOLDINGS", I), "SEC_SHORT_NAME")=INSTRUMENT TP = GET_VALUE(GET_ITEM("FUTURES_CLIENT_HOLDINGS",I), "TOTAL_NET")+0 END IF END FOR END IF
DATETIME=GET_VALUE(GET_DATETIME(), "DATETIME")
DATE=SUBSTR(DATETIME,6,4)&SUBSTR(DATETIME,3,2)&SUBSTR(DATETIME,0,2)
SHORTDATE=SUBSTR(DATETIME,4,1)&SUBSTR(DATETIME,0,2)
TIME=SUBSTR(DATETIME,11,2)&SUBSTR(DATETIME,14,2)&SUBSTR(DATETIME,17,2)+0
N=GET_NUMBER_OF("ORDERS")
ORDERCOUNT=0
IF N>0 THEN
FOR I FROM 0 TO N
IF GET_VALUE (GET_ITEM ("ORDERS", I), "STATUS")="ACTIVE"
ORDERCOUNT=ORDERCOUNT+1 ' СЧЕТЧИК АКТИВНЫХ ЗАЯВОК END IF END FOR END IF
N=GET_NUMBER_OF("TRADES")
PRICE=0
IF N>0 AND TP<>0 AND ORDERCOUNT=0
PRICE=GET_VALUE (GET_ITEM ("TRADES", N), "PRICE") ' ПОЛУЧАЕМ ЦЕНУ КРАЙНЕЙ СДЕЛКИ END IF
SSTATUS=0
SSTATUS=GET_VALUE(GET_PARAM_EX("SPBFUT",INSTRUMENT,"STATUS"),"PARAM_VALUE")+0
TRID=SHORTDATE&TIME
IF TP=0 AND ORDERCOUNT=0
FLAGSTOP=0
FLAGTPROFIT=0
END IF