I have been working on some code to limit Lot Size when the previous trade was a loss. The code is also meant to specify look at the last trade of a Long or a Short.
If the last (Long or Short) trade was profitable the Maximum Lot Size allowed will be allocated to trade.
If the last (Long or Short) trade was NOT profitable the 1000 Lot Size allowed will be allocated to trade.
2 part question:
1) Is there anyway to get the Trade Count to specifically deliver the number of Long or Short Trades?
Currently I am bringing in the count of all trades
2) Is there anything else to consider when trying to asses the profitability of the last trade that I should be aware of?
//Lot Size to Trade if (MoneyInAccountToTradeGTB == true) && (SystemPerformance.LongTrades.TradesPerformance.ProfitFactor[Performance.AllTrades.Count - 1] >= 1) LotSizeToTradeGTB = Math.Floor(((Account.Get(AccountItem.CashValue, Currency.UsDollar) / 100) / Risk.Get("GTB ForexDotCom").ByMasterInstrument[Instrument.MasterInstrument].InitialMargin)) * 1000; else if (MoneyInAccountToTradeGTB == true) && (SystemPerformance.ShortTrades.TradesPerformance.ProfitFactor[Performance.AllTrades.Count - 1] >= 1) LotSizeToTradeGTB = Math.Floor(((Account.Get(AccountItem.CashValue, Currency.UsDollar) / 100) / Risk.Get("GTB ForexDotCom").ByMasterInstrument[Instrument.MasterInstrument].InitialMargin)) * 1000; if (MoneyInAccountToTradeGTB == true) && (SystemPerformance.LongTrades.TradesPerformance.ProfitFactor[Performance.AllTrades.Count - 1] < 1) LotSizeToTradeGTB = 1000; else if (MoneyInAccountToTradeGTB == true) && (SystemPerformance.ShortTrades.TradesPerformance.ProfitFactor[Performance.AllTrades.Count - 1] < 1) LotSizeToTradeGTB = 1000; else (MoneyInAccountToTradeGTB == false) LotSizeToTradeGTB = 0;
Comment