I have a particular set of rules that I employe in many of my strategies. The inputs are always the same.
Right now, I’m always copying and pasting the block of my code in new strategies. Is there a way to create it and call it from any strategy? This way if I have to update it:: I can update one script rather than updating the code in each of my strategy.
For example:
I want to create a function that does the below:
if(Position.MarketPosition==MarketPosition.Flat) { total_fundUSD= (AccountSize+SystemPerformance.AllTrades.TradesPerformance.Currency.CumProfit); double dummyQ = (((int)Math.Floor((total_fundUSD*RiskPercent))) * Leverage); fxToBuy = ((int)(dummyQ/1000))*1000; // Print(total_fundUSD); }
1) how do I create the above as a standalone function?
2) where do i call it in the strategy? Ideally, I'd want to define it as a "name of the function" and then just drop it under OnBarUpdate.
is there an example of this?
Thanks
Comment