Orders Execution
0
Views
0
Downloads
0
Favorites
Profitability Reports
AUD/USD
Oct 2024 - Jan 2025
47.00 %
Total Trades
476
Won Trades
0
Lost trades
0
Win Rate
0.00 %
Expected payoff
-2.86
Gross Profit
1197.00
Gross Loss
-2556.00
Total Net Profit
-1359.00
-100%
-50%
0%
50%
100%
Pending Orders SD
extern double MAGICMA =20050610;
extern double Lots = 0.1;
extern double MaximumRisk = 0.02;
extern double DecreaseFactor = 3;
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int start()
{
double nlots=0.1,order;
int dd=0,hh=0,cnt=0,expiration;
expiration=CurTime()+PERIOD_D1*60;
for(cnt=0 ;cnt< OrdersTotal(); cnt++)
{
OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
if (OrderType() == OP_SELL && OrderSymbol()==Symbol()) hh=1;
if (OrderType() == OP_BUY && OrderSymbol()==Symbol()) dd=1;
}
if (OrdersTotal() >0) return;
int ticket = OrderSend(Symbol(),OP_SELLSTOP,LotsOptimized(),Bid-30*Point,3,Bid+30*Point,Bid-60*Point,"",MAGICMA,expiration,Red);
if (OrdersTotal() >1) return;
ticket = OrderSend(Symbol(),OP_BUYSTOP,LotsOptimized(),Ask+30*Point,3,Ask-30*Point,Ask+60*Point,"",MAGICMA,expiration,Green);
}
double LotsOptimized()
{
double lot=Lots;
int orders=HistoryTotal(); // history orders total
int losses=0; // number of losses orders without a break
//---- select lot size
lot=NormalizeDouble(AccountFreeMargin()*MaximumRisk/1000.0,1);
//---- calcuulate number of losses orders without a break
if(DecreaseFactor>0)
{
for(int i=orders-1;i>=0;i--)
{
if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==false) { Print("Error in history!"); break; }
if(OrderSymbol()!=Symbol() || OrderType()>OP_SELL) continue;
//----
if(OrderProfit()>0) break;
if(OrderProfit()<0) losses++;
}
if(losses>1) lot=NormalizeDouble(lot-lot*losses/DecreaseFactor,1);
}
//---- return lot size
if(lot<0.1) lot=0.1;
if(lot>10) lot=10;
return(lot);
}
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
---