-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGTA1.mq4
67 lines (61 loc) · 4.05 KB
/
GTA1.mq4
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
extern double Lots=0.01,MaxLots=0.5,LotExponent=1,Multiplier=1.5;
extern uchar TakeProfit=50,StopLoss=180;
int ihl,iM=1, TradeLost;
int start(){
//if(ihl!=Time[0]){ ihl=Time[0];
bool lC; // (Local}) Order function checking
char lI=LorC(0,false); // (Local) Count trade
short gS[]={1,0,1,0,1,1,0};
if(lI!=0) return 0; // Cancel off trade and reset
double lS=StopLoss*Point,lP=LorC(),lL=Lots,lD=0,lT=TakeProfit*Point; // (Local) Step size, Last price, Lot size, Direction [0=Buy,1=Sell]
/*for(int i=OrdersHistoryTotal()-1;i>=0;i--){
lC=OrderSelect(i,0,1);
if(OrderSymbol()==Symbol()&&OrderMagicNumber()==0){
if(OrderProfit()<=0){
TradeLost++;
}else{
break;
}
}
}*/
if(TradeLost>=ArraySize(gS)){
lL=Lots;
TradeLost=0;
}else{
lD=gS[TradeLost];
//lL=NormalizeDouble(Lots*MathPow(LotExponent,TradeLost),2);
}
TradeLost++;
if(lD==1) lC=OrderSend(Symbol(),1,lL,Bid,5,Bid+lS,Bid-lT); else lC=OrderSend(Symbol(),0,lL,Ask,5,Ask-lS,Ask+lT);
//}
return 0;
}
double LorC(char a=0, bool b=true){ //Last Price or Count
char cFC,i;
bool c;
for(i=OrdersTotal()-1;i>=0;i--){
c=OrderSelect(i,0);
if(OrderSymbol()==Symbol()&&OrderMagicNumber()==a)
if(!b)cFC++;
else return OrderOpenPrice();
}
return cFC;
}
/*for(int i=OrdersHistoryTotal()-1;i>=0;i--){
lC=OrderSelect(i,0,1);
if(OrderSymbol()==Symbol()&&OrderMagicNumber()==0){
if(OrderProfit()<=0){
lL=NormalizeDouble(OrderLots()*LotExponent,2);
iM++;
if(Multiplier==1)iM=1;
lD=OrderType()==0?1:0;
lS*=Multiplier*iM;
lT*=Multiplier*iM;
}else{
lD=OrderType();
iM=1;
}
break;
}
}
*/