Plt.gca().You are correct to point out that your implementation is terribly inefficient compared to most built-in Numpy operations of similar complexity. Plt.gca().set(title=Symbol+' Draw Down Distribution', ylabel='Total Profit Trades: '+str(len(df_profit))) In order to import in python and see the distribution here is the codeĬreated on Sat Jul 30 17:51:39 Paolo PanicaliĭataPath='C:\\PATH\\'+Symbol +'_Trades.csv'ĭf = pd.read_csv(path_load,sep=" ",decimal=",", engine='python')ĭf_profit = pd.to_numeric(df_profit)ĭf_loss = pd.to_numeric(df_loss) Print("Bars in Trade : " + LossBarsInTradeSerie + " Max RU Bar index : " + MaxRU_Eta + " RU pips " + MaxRU_Value) ![]() LossBarsInTradeSerie = EntryTime_position_index Int MaxRU_ETA_index = EntryTime_position_index - MaxRU_position_index drawdown data for positions went in profitĭouble Position_Max = (EntryTime_position_index) ĭouble Position_RU = Math.Round((Position_Max - EntryPrice_position) / Symbol.PipSize) Print("Bars in Trade : " + BarsInTradeSerie + " Max DD Bar index : " + MaxDD_Eta + " DD pips " + MaxDD_Value) Int MaxDD_ETA_index = EntryTime_position_index - MaxDD_position_index īarsInTradeSerie = EntryTime_position_index double Position_RU = Position_Max - EntryPrice_position double Position_Max = (EntryTime_position_index) ĭouble Position_DD = Math.Round((EntryPrice_position - Position_Min) / Symbol.PipSize) Private void PositionsOnClosed(PositionClosedEventArgs args)ĭateTime EntryTime_position = ĭouble Position_Min = (EntryTime_position_index) Close the CSV file with raw data on trades Print("Stop Loss Pips :" + SL + " and Take profit Pips :" + TP) Print("Average Bars in Trade : " + LossBarsInTrade_avg.Result) MovingAverage LossBarsInTrade_avg = Indicators.MovingAverage(LossBarsInTradeSerie, TotalLossTrades, MovingAverageType.Simple) Print("Average Run Up in Pips : " + RUValue_avg.Result) MovingAverage RUValue_avg = Indicators.MovingAverage(MaxRU_Value, TotalLossTrades, MovingAverageType.Simple) Print("Average Run Up Bars ETA: " + RUETA_avg.Result) MovingAverage RUETA_avg = Indicators.MovingAverage(MaxRU_Eta, TotalLossTrades, MovingAverageType.Simple) Print("Average Bars in Trade : " + BarsInTrade_avg.Result) ![]() MovingAverage BarsInTrade_avg = Indicators.MovingAverage(BarsInTradeSerie, TotalProfitTrades, MovingAverageType.Simple) Print("Average Draw Down in Pips : " + DDValue_avg.Result) MovingAverage DDValue_avg = Indicators.MovingAverage(MaxDD_Value, TotalProfitTrades, MovingAverageType.Simple) Print("Average Draw Down Bars ETA: " + DDETA_avg.Result) MovingAverage DDETA_avg = Indicators.MovingAverage(MaxDD_Eta, TotalProfitTrades, MovingAverageType.Simple) Int TotalProfitTrades = MaxDD_Eta.Count() Var filePath = Path.Combine("C:\\PATH", filename) prepare a csv file to store the resultsįilename = Symbol.Name + "_Trades" + ".csv" ![]() LossBarsInTradeSerie = CreateDataSeries() IndicatorDataSeries LossBarsInTradeSerie System.Random random = new System.Random() Run Up and Draw Downs save to csv by paolo panicali july 2022 The robot write on a CSV file with the data of the trades, it needs AccessRights = AccessRights.FileSystem if you do not want Ctrader to have access to your computer to save CSV file, you can remove the filewriter code and keep AccessRights = AccessRights.None Somebody might tell us if I made a mistake or it s ok. I found out that the Run ups distribution is normal while the drawdown distribution is not. The bot buys randomly, Do not use this in live trading, remember to switch to a demo account when testing. Hi I just made this, the code has to be carefully checked but it seems to work fine. , 19:56 Drawdowns and RunUps of each trade in Ctrader and results saved to csv file in order to make further investigations on Python
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |