MyTradingHistory
- Kütüphaneler
- Max Timur Soenmez
- Sürüm: 1.0
- Etkinleştirmeler: 10
Kullanımı kolay bir kütüphane, geliştiricilere MQL5 EA'ları için temel ticaret istatistiklerine kolay erişim sağlar.
Kütüphaneden mevcut olan metodlar:
Hesap Verileri ve Kar:
- GetAccountBalance() : Mevcut hesap bakiyesini döndürür.
- GetProfit() : Tüm işlemlerden net karı döndürür.
- GetDeposit() : Toplam depozito miktarını döndürür.
- GetWithdrawal() : Toplam çekim miktarını döndürür.
Ticaret Analizi:
- GetProfitTrades() : Kar eden işlemlerin sayısını döndürür.
- GetLossTrades() : Zarar eden işlemlerin sayısını döndürür.
- GetTotalTrades() : Yapılan toplam işlem sayısını döndürür.
- GetShortTrades() : Kısa işlemlerin sayısını döndürür.
- GetLongTrades() : Uzun işlemlerin sayısını döndürür.
- GetWinLossRatio() : Kazanan ve kaybeden işlemlerin oranını döndürür.
- GetAverageProfitTrade() : Kar eden işlemler için ortalama karı döndürür.
- GetAverageLossTrade() : Zarar eden işlemler için ortalama zararı döndürür.
- GetROI() : Yatırım getirisini hesaplar.
- GetLargestProfitTrade() : Tek bir işlemdeki en büyük karı döndürür.
- GetLargestLossTrade() : Tek bir işlemdeki en büyük zararı döndürür.
- GetShortTradesWon() : Başarılı kısa işlemlerin yüzdesini döndürür.
- GetLongTradesWon() : Başarılı uzun işlemlerin yüzdesini döndürür.
İşlem Karı Dizisi:
- GetTradeProfitArray(double &outputArray[]) : Her bir işlem için karları içeren bir dizi döndürür, böylece işlemlerin ayrıntılı sonuçları analiz edilebilir.
Örnek kod aşağıda:
// Import the external MyTradingHistory.ex5 module #import "MyTradingHistory.ex5" void UpdateValues(void); // Updates the trading data from the MyTradingHistory library. EXECUTE THIS EVERY TIME YOU WANT TO UPDATE THE VALUES, e.g. after closing a trade or before retreiving the value for the first time. void GetTradeProfitArray(double &outputArray[]); // Retrieves an array of profits from closed trades double GetAccountBalance(void); // Returns the current account balance double GetProfit(void); // Returns the net profit double GetDeposit(void); // Returns the total deposit amount double GetWithdrawal(void); // Returns the total withdrawal amount int GetProfitTrades(void); // Returns the number of profitable trades int GetLossTrades(void); // Returns the number of loss trades int GetTotalTrades(void); // Returns the total number of trades int GetShortTrades(void); // Returns the number of short trades int GetLongTrades(void); // Returns the number of long trades double GetWinLossRatio(void); // Returns the win-to-loss ratio double GetAverageProfitTrade(void); // Returns the average profit per trade double GetAverageLossTrade(void); // Returns the average loss per trade double GetROI(void); // Returns the return on investment (ROI) double GetLargestProfitTrade(void); // Returns the largest profit from a single trade double GetLargestLossTrade(void); // Returns the largest loss from a single trade double GetShortTradesWon(void); // Returns the percentage of short trades won double GetLongTradesWon(void); // Returns the percentage of long trades won #import // OnInit is executed when the script starts int OnInit() { // Update internal data from the imported module UpdateValues(); // Prepare a string to display account and trade summary string output = "Account Balance: " + DoubleToString(GetAccountBalance(), 2) + "\n" + "Net Profit: " + DoubleToString(GetProfit(), 2) + "\n" + "Deposit: " + DoubleToString(GetDeposit(), 2) + "\n" + "Withdrawal: " + DoubleToString(GetWithdrawal(), 2) + "\n" + "Profit Trades: " + IntegerToString(GetProfitTrades()) + "\n" + "Loss Trades: " + IntegerToString(GetLossTrades()) + "\n" + "Total Trades: " + IntegerToString(GetTotalTrades()) + "\n" + "Short Trades: " + IntegerToString(GetShortTrades()) + "\n" + "Long Trades: " + IntegerToString(GetLongTrades()) + "\n" + "Win/Loss Ratio: " + DoubleToString(GetWinLossRatio(), 2) + "\n" + "Average Profit per Trade: " + DoubleToString(GetAverageProfitTrade(), 2) + "\n" + "Average Loss per Trade: " + DoubleToString(GetAverageLossTrade(), 2) + "\n" + "ROI: " + DoubleToString(GetROI(), 2) + "\n" + "Largest Profit Trade: " + DoubleToString(GetLargestProfitTrade(), 2) + "\n" + "Largest Loss Trade: " + DoubleToString(GetLargestLossTrade(), 2) + "\n" + "Short Trades Won: " + DoubleToString(GetShortTradesWon(), 2) + "%\n" + "Long Trades Won: " + DoubleToString(GetLongTradesWon(), 2) + "%\n"; // Add trade profit array data to the output output += "Trade Profit Array (First 5 Trades): "; double tradeProfitArray[]; // Declare an array to store trade profit data GetTradeProfitArray(tradeProfitArray); // Fetch trade profit data // Loop through the first 5 trades and append their profit values to the output for (int i = 0; i < MathMin(5, ArraySize(tradeProfitArray)); i++) { output += DoubleToString(tradeProfitArray[i], 2) + ", "; } // Append the last trade's profit value output += "...\nLast Closed Trade: "; int size = ArraySize(tradeProfitArray); // Get the size of the trade profit array if (size > 0) output += DoubleToString(tradeProfitArray[size - 1], 2); // Append the last trade's profit else output += "No trades available."; // Handle the case where no trades exist // Display the summary as a comment on the chart Comment(output); // Signal successful initialization return(INIT_SUCCEEDED); }
Yorumlarınız memnuniyetle karşılanır ve takdir edilir. Lütfen satın almadan önce ve sonra düşüncelerinizi ve sorularınızı paylaşın.
https://www.mql5.com/en/users/maxsonm
