Orders Execution
Miscellaneous
0
Views
0
Downloads
0
Favorites
Profitability Reports
AUD/USD
Oct 2024 - Jan 2025
64.00 %
Total Trades
1029
Won Trades
0
Lost trades
0
Win Rate
0.00 %
Expected payoff
-5.82
Gross Profit
10541.50
Gross Loss
-16529.90
Total Net Profit
-5988.40
-100%
-50%
0%
50%
100%
MiniPlatinum
/*[[
Name := Pipsoed
Author := Copyright © 2005, HomeSoft Corp.
Link := spiky@sinet.spb.ru
Lots := 0.1
Stop Loss := 1000
Take Profit := 1000
Trailing Stop := 0
]]*/
extern int
mgod=2005;
extern bool
auto=true;
extern double
lots=0.1;
extern int
del=9,
tpl=120,
stl=30,
depth=12,
deviation=5,
backstep=3,
nstl=1,
eaID=993872;
int
cnt,
j,
s,b,
os,ob,
mods,
top,
oldf,
LTT,
dblok;
string
reg,
fname;
double
MaxH,MinL,
bsum,ssum,
mlot,
summa,
MidL,
kr,
blot,
slot,
ks,
kb,
ps,
pb,
DSum,
zz,
zz0;
int start()
{
Preset();
RangeCalculation();
OrderManagement();
DataDisplay();
ModifyOrder();
ModifyOrder2();
CloseOrder();
DeleteOrder();
PlaceOrder();
return;
}
//----------------------------------------Âû÷èñëåíèå äàííûõ äëÿ ðàáîòû ýêñïåðà-------------------------------------
void Preset()
{
//if (start==0 ) return;
if (Year()<mgod ) return;
if (lots>=1 && AccountBalance()>=10000 ) kr=NormalizeDouble((AccountBalance()/10000),0);
if (lots==1 && AccountBalance()<10000 ) kr=1;
if (lots<1 && AccountBalance()>=1000 ) kr=NormalizeDouble((AccountBalance()/1000),0);
if (lots<1 && AccountBalance()<1000 ) kr=1;
if (kr>1000 ) kr=1000;
mlot=kr*lots;
if (mlot>1 ) mlot=NormalizeDouble((kr*lots),0);
j++;
if (Minute()==0 ) j=0;
if (Symbol()=="EURUSD" ) fname="FEUR";
if (Symbol()=="GBPUSD" ) fname="FGBP";
if (Symbol()=="USDCHF" ) fname="FCHF";
if (Symbol()=="USDJPY" ) fname="FJPY";
if (Symbol()=="USDCAD" ) fname="FCAD";
if (Hour()>=0 && Minute()>=0 && j==5 && s+b==0 )
{
oldf=FileOpen(fname,FILE_CSV|FILE_WRITE,"!");
FileSeek(oldf,0,SEEK_END);
FileWrite(oldf,Month(),Day(),DSum);
FileClose(oldf);
DSum=0;
}
if (auto) reg="Àâòî";
if (!auto) reg="Õýíäë";
}
void RangeCalculation()
{
if (((High[0]-Low[0])/Point)>=10 && Hour()==23 && Minute()>=55 )
{
MaxH = High[0];
MinL = Low[0];
} else {
MaxH = High[1];
MinL = Low[1];
}
MidL = NormalizeDouble(((MaxH+MinL)/2),Digits);
zz=iCustom(Symbol(),0,"ZigZag",depth,deviation,backstep,0,3);
zz0=iCustom(Symbol(),0,"ZigZag",depth,deviation,backstep,0,0);
if (zz!=0 && zz>High[0] && Hour()==23 && Minute()>=55 ) top=1;
if (zz!=0 && zz<Low[0] && Hour()==23 && Minute()>=55 ) top=-1;
if (zz0>0 ) top=0;
}
//----------------------------------------Ïîäñ÷¸ò àêòèâíûõ è ïàññèâíûõ îðäåðîâ----------------------------------------
void OrderManagement()
{
s=0; b=0;
os=0; ob=0;
summa=0;
slot=0;blot=0;
ssum=0;bsum=0;
for (int cnt=0; cnt<OrdersTotal(); cnt++)
{
OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
if (OrderMagicNumber()==eaID && OrderSymbol()==Symbol())
{
if ( OrderType()==OP_SELL || OrderType()==OP_BUY)
summa=summa+OrderProfit();
if ( OrderType()==OP_SELL )
{
ssum=ssum+OrderProfit();
slot=slot+OrderLots();
s++;
}
if ( OrderType()==OP_BUY )
{
bsum=bsum+OrderProfit();
blot=blot+OrderLots();
b++;
}
if ( OrderType()==OP_SELLSTOP ) os++;
if ( OrderType()==OP_BUYSTOP ) ob++;
}
}
if (s+b==0)
{
ps=0; pb=0;
ks=0; kb=0;
mods=0;
}
}
//---------------------------------------------------Êîììåíòàðèè------------------------------------------------------
void DataDisplay()
{
Comment("Data: ",Year(),".",Month(),".",Day()," Time ",Hour(),":",Minute()," JInd=",j," APoz=",s+b," Ords=",os+ob," Ks=",ks,
" Kb=",kb," Ps=",ps," Pb=",pb," SumProf=",MathRound(DSum)," Ðåæèì: ",reg);
Print("Data: ",Year(),".",Month(),".",Day()," Time ",Hour(),":",Minute()," JInd=",j," Ords=",os+ob," APoz=",s+b," Ks=",ks,
" Kb=",kb," Mlot=",mlot," ZZ0=",MathRound(zz0)," ZZ3=",MathRound(zz)," SumProf=",MathRound(DSum)," Profit=",MathRound(summa));
if (CurTime()-LTT<15 ) return;
}
//------------------------------Ïðîöåäóðà ïåðåâîäà ïðîôèòíîé ïîçèöèè â áåçúóáûòîê-------------------------------------
void ModifyOrder()
{
if (summa>=100*mlot && mods==0 )
{
for (int cnt=0; cnt<OrdersTotal(); cnt++)
{
OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
if (OrderMagicNumber()==eaID && OrderSymbol()==Symbol())
{
if ( OrderType()==OP_SELL && s>0 && (OrderOpenPrice()-Close[0])/Point>=10 )
{
OrderModify(OrderTicket(),OrderOpenPrice(),
OrderOpenPrice()-nstl*Point,OrderTakeProfit(),Gold);
mods=1;
return;
}
if ( OrderType()==OP_BUY && b>0 && (Close[0]-OrderOpenPrice())/Point>=10 )
{
OrderModify(OrderTicket(),OrderOpenPrice(),
OrderOpenPrice()+nstl*Point,OrderTakeProfit(),Gold);
mods=1;
return;
}
}
}
}
}
//--------------------------------Ïðîöåäóðà ìîäèôèêàöèè ñòîïà ïðîôèòíîé ïîçèöèè--------------------------------------
void ModifyOrder2()
{
ks=NormalizeDouble((((MinL-Close[0])/Point)/stl),0);
kb=NormalizeDouble((((Close[0]-MaxH)/Point)/stl),0);
if (ks<0) ks=0; if (kb<0) kb=0;
if (summa>0 && (ks>=1 || kb>=1) && (ks>ps || kb>pb))
{
for (int cnt=0; cnt<OrdersTotal(); cnt++)
{
OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
if (OrderMagicNumber()==eaID && OrderSymbol()==Symbol())
{
if ( OrderType()==OP_SELL && s>0 && Close[0]-OrderOpenPrice()>=6)
{
OrderModify(OrderTicket(),OrderOpenPrice(),
OrderOpenPrice()-ks*stl*Point+stl*Point,
OrderTakeProfit(),Gold);
ps=ks;
return;
}
if ( OrderType()==OP_BUY && b>0 && OrderOpenPrice()-Close[0]>=6)
{
OrderModify(OrderTicket(),OrderOpenPrice(),
OrderOpenPrice()+kb*stl*Point-stl*Point,
OrderTakeProfit(),Gold);
pb=kb;
return;
}
}
}
}
}
//-------------------------------------------Çàêðûòèå àêòèâíûõ ïîçèöèé ----------------------------------------------
void CloseOrder()
{
if (Hour()==23 && Minute()>=50 && s+b>0 )
{
for (int cnt=0; cnt<OrdersTotal(); cnt++)
{
OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
if (OrderMagicNumber()==eaID && OrderSymbol()==Symbol())
{
if (OrderType()==OP_SELL)
{
DSum=DSum+OrderProfit();
OrderClose(OrderTicket(),OrderLots(),Ask,5,Red);
return;
}
if (OrderType()==OP_BUY)
{
DSum=DSum+OrderProfit();
OrderClose(OrderTicket(),OrderLots(),Bid,5,Red);
return;
}
}
}
}
}
//-----------------------------------------Óäàëåíèå íåèñïîëüçîâàííûõ îäåðîâ-------------------------------------------
void DeleteOrder()
{
if (Hour()==23 && Minute()<50) dblok=0;
if (Hour()==23 && Minute()>=50 && dblok==0)
{
if (os+ob==1) dblok=1;
for (int cnt=0; cnt<OrdersTotal(); cnt++)
{
OrderSelect(cnt,SELECT_BY_POS,MODE_TRADES);
if (OrderMagicNumber()==eaID && OrderSymbol()==Symbol())
{
OrderDelete(OrderTicket());
return;
}
}
}
}
//------------------------------------------Âûñòàâëåíèå êàíàëüíûõ îðäåðîâ---------------------------------------------
void PlaceOrder()
{
if ((Hour()==23 && Minute()>=55) || s+b+os+ob<2 )
{
if (auto==0 )
Comment("ÓÑÒÀÍÎÂÈÒÅ ÄÂÀ ÎÐÄÅÐÀ ÇÀ ÏÐÅÄÅËÀÌÈ ÊÀÍÀËÀ (Â ÐÅÆÈÌÅ ÀÂÒÎ ÝÒÎÃÎ ÄÅËÀÒÜ ÍÅ ÍÀÄÎ), À ÎÑÒÀËÜÍÎÅ ÑÄÅËÀÞ ß");
if (auto==1 && MaxH!=0 && MinL!=0 )
{
if (os==0 && s==0 && ((Close[0]-MinL)/Point)>=5 && (top==1 || top==0))
{
OrderSend(Symbol(),OP_SELLSTOP,mlot,
MinL-del*Point,5,MinL-del*Point+stl*Point,MinL-del*Point-tpl*Point,
NULL,eaID,0,Gold);
return;
}
if (os==0 && s==0 && ((Close[0]-MinL)/Point)<=0 && (top==1 || top==0))
{
OrderSend(Symbol(),OP_SELLSTOP,mlot,
Bid-del*Point,5,Bid-del*Point+stl*Point,Bid-del*Point-tpl*Point,
NULL,eaID,0,Gold);
return;
}
if (ob==0 && b==0 && ((MaxH-Close[0])/Point)>=5 && (top==-1 || top==0))
{
OrderSend(Symbol(),OP_BUYSTOP,mlot,
MaxH+del*Point,5,MaxH+del*Point-stl*Point,MaxH+del*Point+tpl*Point,
NULL,eaID,0,Gold);
return;
}
if (ob==0 && b==0 && ((MaxH-Close[0])/Point)<=0 && (top==-1 || top==0))
{
OrderSend(Symbol(),OP_BUYSTOP,mlot,
Ask+del*Point,5,Ask+del*Point-stl*Point,Ask+del*Point+tpl*Point,
NULL,eaID,0,Gold);
return;
}
}
}
}
//-------------------------------------------------------END----------------------------------------------------------
Comments
Markdown Formatting Guide
# H1
## H2
### H3
**bold text**
*italicized text*
[title](https://www.example.com)

`code`
```
code block
```
> blockquote
- Item 1
- Item 2
1. First item
2. Second item
---