//MANAGE LOSSES #region LOSSES MAnagement //STEP 1: Reset the trade Counter at Beginning of NEW Session if (Bars.FirstBarOfSession && FirstTickOfBar) { previousLossTrade = 0; priorSessionTrades = Performance.AllTrades.Count; } //STEP 2: Here, Performance.AllTrades.Count - priorSessionTrades checks to make sure there have been 1 trades today. // priorNumberOfTrades makes sure this code block only executes when a new trade has finished. if ( FirstTickOfBar && (Performance.AllTrades.Count - priorSessionTrades) >= 1 && Performance.AllTrades.Count != priorNumberOfTrades) { // Reset the counter. previousLossTrade = 0; // Set the new number of completed trades. priorNumberOfTrades = Performance.AllTrades.Count; //Look at Last Trade (index 1) Performance Trade lastTrade = Performance.AllTrades[Performance.AllTrades.Count - 1]; lastProfit = lastTrade.ProfitPoints; //If the trade's profit is greater than Set Target, RESET COUNTER. IF Less than Loss Target, Add one. if (lastTrade.ProfitPoints >= 2) previousLossTrade = 0; else if (lastTrade.ProfitPoints <= -1.8) previousLossTrade++; Print("The last trade's profitLoss is " + lastProfit); Print("Last Trade Won/Loss: " + previousLossTrade); } //REGULAR Position Size: If Previous Trade Didn't Lose, Go for Regular Profit Target and Position Size if(previousLossTrade == 0) { tradeLotSize = scalpLotSize; takeProfit = profitTarget; } //RECOVERY TRADE Size:: If Only One Previous LOSS occurred, Increase Size and Target to Recover else if(previousLossTrade == 1) { tradeLotSize = scalpLotSize * 3; takeProfit = recoveryTarget; } //2nd RECOVERY TRADE Size:: If Two Previous LOSSes occurred, Increase Size and Target to Recover else if(previousLossTrade == 2) { tradeLotSize = scalpLotSize * 6; takeProfit = recoveryTarget; } //PRINT Current Position Size after High Volume APpears. So you always know what the Next Trade size will be in OutPut Window if(Volume[0] >= Volume[1]) { Print("NEXT POSITION SIZE " + tradeLotSize); } #endregion
Please Help.
Thank You
Comment