Hey guys,
Hope you're all doing ok. Apologies for my noob level coding. There are two concepts below that I am trying to get my head around and still struggling with. If anyone could assist, explain or point me in the right direction that would be a huge help!
These are conditional sell rules - which I think I have achieved.
but more importantly scaling out rules - and how to combine them with the conditional sell rules. I have tried to read the pyramiding threads and examples on the forum, however the logic is not making a lot of sense to me at this stage of my development.
Essentially what I want to do is the following. Say I buy a 52 week high and its an explosive move. I want to be able to say that if the if the move is extended (my condition in this scenario is a certain % above key moving average) I tighten the trailing stop (which is a sell below a faster moving average). I also want to be able to scale out say 50% of my position in this faster moving average and then maybe the remaining 50% on the slower/original moving average in hope of a bigger/longer move in time.
I would like to be able to get to the stage where I could test/implement whether selling a higher % than 50% of my position into an even higher extended or explosive move would benefit my system. So potentially in my script could have multiple conditions depending on how explosive the move is.
However at this stage would appreciate if i could get some help trying to do the basics for a 50% & 50% faster and slower moving average scenario so i can get a better idea of how sigscaleout works with a conditional sell rule
My basic example code below.
Any help would be appreciated. Again, I'm not perfect but I'm trying to learn the best I can.
Cheers,
Brad
SetOption("MaxOpenPositions",20);
SetPositionSize(5,spsPercentOfEquity);
BuyCondition1 = HHV(C,250);
SellCondition1 = C<MA(C,20);
SellCondition2 = C<MA(C,10);
extended = C>1.1*MA(C,20);
Buy = C>= BuyCondition1;
Sell = IIf(SumSince(Buy,extended)>1,Sellcondition2,sellcondition1);
SetPositionSize( 50, spsPercentOfPosition * ( Buy == sigScaleOut ) ); // scale out 50% of position