Modify My EA Please - Dynamic Volume Size

仕事が完了した

実行時間2 日
依頼者からのフィードバック
Cannot Complain Very happy. Went above and beyond for me. Will hire again if needed.
開発者からのフィードバック
Thank you for the order, my Friend. 5-star customer.

指定

I need a dynamic lot size for my expert advisor with 3 input options:

1. fixed lot size (0.01)

if my account balance is $100,000 & I want to risk 0.01 lots per trade

2. Volume based on money ($1000)  Example: 

if my account balance is $100,000 & I want to risk $1000 of my account per trade (0.01 volume)

3. volume based on account percent (1%) Example: 

if my account balance is $100,000 & I want to risk 1% of my account per trade (0.01 volume)


Most of the code has already been done, it just doesn't do what i want it to...

Heres The Code:


input group "General Settings"                                  // General Setting Input Grouping
enum LOT_MODE_ENUM{                                            // Options
    LOT_MODE_FIXED,                                                  // Fixed Lots
    LOT_MODE_MONEY,                                                    // Lots Based On Money
    LOT_MODE_PCT_ACCOUNT                                          // Lots Based On % Of Account
};

input LOT_MODE_ENUM LotMode = LOT_MODE_FIXED;  // Lot Mode Option
input double   FixedLots              = 0.01;                     // Lots
input double   Money                = 1000;                     // Money
input double   PercentOfAccount      = 5;                          // Percent
input double   AccountBalance       = 100000;              // your account balance

    -------------------------Functions-------------------------------
// Calculate Lots
bool CalculateLots(double slDistance, double &lots){

   lots = 0.0;
   if(LotMode==LOT_MODE_FIXED){
   lots = FixedLots;
   }
   else{
      double tickSize = SymbolInfoDouble(_Symbol,SYMBOL_TRADE_TICK_SIZE);
      double tickValue = SymbolInfoDouble(_Symbol,SYMBOL_TRADE_TICK_VALUE);
      double volumeStep = SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_STEP);
     
      double riskMoney = LotMode==LOT_MODE_MONEY ? Money : AccountInfoDouble(ACCOUNT_BALANCE) * PercentOfAccount * 0.01;
      double moneyVolumeStep = (slDistance / tickSize) * tickValue * volumeStep;
     
      lots = MathFloor(riskMoney/moneyVolumeStep) * volumeStep;
   }
   // Check Calculated lots
   if(!CheckLots(lots)){return false;}
   
   return true;
}

// Check Lots For Min, Max And Step
bool CheckLots(double &lots){

   double min = SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_MIN);
   double max = SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_MAX);
   double step = SymbolInfoDouble(_Symbol,SYMBOL_VOLUME_STEP);
   
   if(lots<min){
      Print("Lot Size Will Be Set To The Minimum Allowable Volume");
      lots = min;
      return true;
   }
   if(lots>max){
      lots = max;
   Print("Lot Size Will Be Set To The Maximum Allowable Volume");
   return false;
   }
   lots = (int)MathFloor(lots/step) * step;
   
   return true;
}

// Calculate Lots - Paste in between "calc sl & tp" & "Open buy positions"
double lots;
if(!CalculateLots(lastTick.bid-sl,lots)){return;}

// Calculate Lots - Paste in between "calc sl & tp" & "Open sell positions"
double lots;
if(!CalculateLots(sl-lastTick.ask,lots)){return;}

応答済み

1
開発者 1
評価
(137)
プロジェクト
160
23%
仲裁
7
0% / 43%
期限切れ
4
3%
取り込み中
2
開発者 2
評価
(92)
プロジェクト
109
34%
仲裁
5
40% / 20%
期限切れ
5
5%
仕事中
3
開発者 3
評価
(22)
プロジェクト
28
11%
仲裁
6
33% / 50%
期限切れ
4
14%
仕事中
4
開発者 4
評価
(12)
プロジェクト
15
40%
仲裁
2
50% / 50%
期限切れ
0
仕事中
類似した注文
I have a custom EA that works fine in the live market trading, but when doing a back test in the strategy tester , it does not open sell orders. There are no errors or warnings; it just doesn't open sell orders. I've checked every possible reason that might be the reason why it does not open sell orders, but I can't find anything, especially since it works fine in the real market and it opens both buys and sells
I'm looking for someone to help me create an arbitrage trading robot that can trade on any decentralized exchange and forex market. I already have some source code to a strategy but would like to enhance it to make it profitable and automated
I installed the E.A. into the Experts folder in MT4. When I double click on it nothing happens. When I right click and "attach to chart" nothing happens. The E.A. is not grayed out, it simply will not attach. Any help would be greatly Appreciated
I have an EA and want to add few new logic to fetch profit taking factors and other values from an external master data and use it in existing EA
I need EA that works on MT5 to be able to do the following: - Can recognize Support/Resistance area - Can recognize VWAP direction. - Can recognize RSI. - Can recognize Double Top/bottom, Bullish/Bearish hammer candle, Bullish/bearish engulfing candle. - Ability to set Stoploss below/above support/resistance, but risk must be fixed at a certain price. - Stoploss
I want a program that will help calculate and enter the market on full margin for me. I just need to put in the price for entry, Stop loss and TP then it will calculate the lot sizes for entering the trade on full margin on Mt5
I am seeking a highly skilled and experienced developer to assist with an important project. I need a development of an automated trading bot for NinjaTrader, utilizing a 4 SMA (Simple Moving Average) crossing strategy, with additional custom diversions for trade entries. The bot needs to be based on a strategy involving the crossing of four different SMAs. The exact periods for these SMAs and the conditions for
So i have copier EA. The idea is the EA will triggered through manual OP by user via mobile or whatever platform. Let's say 0.01 lot to trigger it. After the EA takes master's position, the EA will be standby mode. If the master take more OP, the EA still not take the master's position (OP) until the user input manually once again via mobile for another 0.01 lot. Since this is a MT4 EA, Whenever user want to close
preciso de um robô com duas médias móveis, uma exponencial high e uma exponencial low. preciso também ter a opção de utilizar e todos os tempos gráficos e alterar os parâmetros das médias. entrada de compra será feita quando um candle de alta romper e fechar a cima da média high e fechará a posição quando um candle de baixa romper e fechar a baixo da média low. a venda será feita quando o candle de baixa romper e
Description - An expert advisor(s), placing sell trades in EUR/USD, based on the close price of the previous two candles, as shown in the figure below. The trades would be made in the 5 minute, 1 hour, and 1 day timeframes. In the 5 minute and 1 hour timeframes the market orders would be placed at the start of a new candle, at specific times EST. The order would be cancelled at the close of that candle, i.e after 5

プロジェクト情報

予算
30+ USD
開発者用
27 USD
締め切り
最低 1 最高 7 日