Hello!
Got another question here. I was wondering how to use the MAX method to record the highest price of a symbol. Currently, my resolution is in seconds and using data[symbol].High
only records the highest price for the last tick bar. Instinctually I want to implement something like this if (symPrice is greater than lastSymPrice)
{
symPrice = data[symbol].Price;
}
Though that doesn't logically work. I was also trying to implement a rolling window to look back at the previous bars but kept getting errors. Take a look at my code and you'll see that I've implemented a TradeBar consolidator to consolidate my second resolution into a minute resolution. It functions correctly but I still end up losing money because I have to wait a minute for the price to update.
In short. What I'm trying to do is set a trigger after reaching 3% profits and then set a stop that's 10% under that 3%.
EX: 400 shares of stock ABC at price 2.5 = $1000
3% of 1000 is 30 and 10% of 30 is 3.
30-3 = 27
27 = new stop
If the profits rise to 35 then the new stop becomes 31.5
if current profits go below 27 then you sell.