Initial commit: MQL5 Scripts Collection (MetaTrader 5)
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
# 🚀 Unlock the Power of Trading!
|
||||
|
||||
Welcome to this open-source trading project. Here you will find powerful tools to enhance your trading journey. If you find this project useful, please consider starring ⭐, sharing, or donating to support further development!
|
||||
|
||||
---
|
||||
|
||||
**Support the project:**
|
||||
- Star this repository on GitHub
|
||||
- Share it with your trading friends
|
||||
- [Donate here](https://www.paypal.com/donate/?hosted_button_id=YOUR_BUTTON_ID) to help us grow!
|
||||
|
||||
---
|
||||

|
||||

|
||||

|
||||
|
||||
## Source Files
|
||||
- `ytg_percent_lot.mq5`
|
||||
|
||||
---
|
||||
> Made with ❤️ for the trading community.
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 9.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.6 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
@@ -0,0 +1,53 @@
|
||||
//+------------------------------------------------------------------+
|
||||
//| ytg_Percent_Lot.mq5 |
|
||||
//| Yuriy Tokman |
|
||||
//| http://www.mql-design.ru |
|
||||
//+------------------------------------------------------------------+
|
||||
#property copyright "Yuriy Tokman"
|
||||
#property link "http://www.mql-design.ru"
|
||||
#property version "1.00"
|
||||
|
||||
#property description "www.mql-design.ru"
|
||||
#property description ""
|
||||
#property description "yuriytokman@gmail.com "
|
||||
#property description ""
|
||||
#property description "Skype - yuriy.g.t"
|
||||
|
||||
#property script_show_inputs
|
||||
|
||||
input double Risk=33.3;
|
||||
//+------------------------------------------------------------------+
|
||||
//| Script program start function |
|
||||
//+------------------------------------------------------------------+
|
||||
void OnStart()
|
||||
{
|
||||
//---
|
||||
Alert("Free margin=",AccountInfoDouble(ACCOUNT_FREEMARGIN)," ",AccountInfoString(ACCOUNT_CURRENCY),
|
||||
" Risk percent=",Risk,
|
||||
"% Lots=",GetLot());
|
||||
//---
|
||||
}
|
||||
//+------------------------------------------------------------------+
|
||||
//| GetLot |
|
||||
//+------------------------------------------------------------------+
|
||||
double GetLot()
|
||||
{
|
||||
double price=0.0;
|
||||
double margin=0.0;
|
||||
double MaximumRisk=Risk/100;
|
||||
|
||||
if(!SymbolInfoDouble(_Symbol,SYMBOL_ASK,price)) return(0.0);
|
||||
if(!OrderCalcMargin(ORDER_TYPE_BUY,_Symbol,1.0,price,margin)) return(0.0);
|
||||
if(margin<=0.0) return(0.0);
|
||||
|
||||
double min_volume=SymbolInfoDouble(Symbol(),SYMBOL_VOLUME_MIN);
|
||||
double max_volume=SymbolInfoDouble(Symbol(),SYMBOL_VOLUME_MAX);
|
||||
|
||||
double lot=NormalizeDouble(AccountInfoDouble(ACCOUNT_FREEMARGIN)*MaximumRisk/margin,2);
|
||||
|
||||
//if(Volume>0)lot=Volume;
|
||||
if(lot<min_volume)lot=min_volume;
|
||||
if(lot>max_volume)lot=max_volume;
|
||||
return(lot);
|
||||
}
|
||||
//+------------------------------------------------------------------+
|
||||
Reference in New Issue
Block a user