Hi there,
I'm trying to write code for backtesting of trading strategy.
Given:
Active Worksheet with:
Range C2:C200 with range of Text values: Buy, Sell or empty cell
Range B2:B200 with Closing Price
Lets assume B2= 7.30 is a price per share
Reference Worksheet ("Control") with:
Range.B("10").Value= 1000 is a Buying power in USD
Range.B("11").Value=5 is commission per trade in USD
How to write formula with conditions as it follows:
if C2 = "Buy" Then (1000-5)/7.30 write down result in D2 - whole number!
if C2 = "Sell" Then (D2*7.30)-5 write down result in E2
if C2 = empty cell then do nothing
Thank you in advance
I'm trying to write code for backtesting of trading strategy.
Given:
Active Worksheet with:
Range C2:C200 with range of Text values: Buy, Sell or empty cell
Range B2:B200 with Closing Price
Lets assume B2= 7.30 is a price per share
Reference Worksheet ("Control") with:
Range.B("10").Value= 1000 is a Buying power in USD
Range.B("11").Value=5 is commission per trade in USD
How to write formula with conditions as it follows:
if C2 = "Buy" Then (1000-5)/7.30 write down result in D2 - whole number!
if C2 = "Sell" Then (D2*7.30)-5 write down result in E2
if C2 = empty cell then do nothing
Thank you in advance