Orders Execution
0
Views
0
Downloads
0
Favorites
Lot_Multiple
//+------------------------------------------------------------------+
//| Lot Multiple.mq4 |
//| Copyright 2016, MetaQuotes Software Corp. |
//| https://jmeel24@yahoo.com |
//+------------------------------------------------------------------+
#property library
#property copyright "Copyright 2016, MetaQuotes Software Corp."
#property link "https://jmeel24@yahoo.com"
#property version "1.00"
#property strict
extern double MagicNo=280456;
extern double Lots=0.01;
extern int Stoploss=100;
extern int Takeprofit=400;
extern string Multiple_disable="0 = Stop Use Multiple ";
extern string FiboMultiple="1 = 1,1,2,3,5,8,13,21,34, etc. ";
extern string Multi_X="2 = Last Close Lot X 2 ";
extern string Multi_Plus="3 = Last Close Lot + Lot ";
extern int Enter_Choice = 2;
double Lots_Multiplier=2;
//+------------------------------------------------------------------+
//| NewLot function |
//+------------------------------------------------------------------+
// int MyCalculator(int value,int value2) export
double NewLot()
{
double NewLot=Lots;
double lot=0,lot2=0;
double loss=0,loss2=0;
for(int i=0;i<=OrdersHistoryTotal();i++)
{
bool OS0=OrderSelect(i,SELECT_BY_POS,MODE_HISTORY);
if(OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNo)
{
lot=OrderLots(); loss=OrderProfit();
}
}
for(int s=0;s<=OrdersHistoryTotal()-2;s++)
{
bool OS1=OrderSelect(s,SELECT_BY_POS,MODE_HISTORY);
if(OrderSymbol()==Symbol() && OrderMagicNumber()==MagicNo)
{
lot2=OrderLots(); loss2=OrderProfit();
}
}
if(Enter_Choice==1 && loss+loss2<0) NewLot=lot+lot2;
if(Enter_Choice==1 && loss+loss2>0) NewLot=Lots;
if(Enter_Choice==2 && loss<0) NewLot=lot*Lots_Multiplier;
if(Enter_Choice==3 && loss<0) NewLot=lot+Lots;
if(Enter_Choice==0) NewLot=Lots;
return(NewLot);
}
//+------------------------------------------------------------------+
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
---