Ranking of Buy Date & Candlestick Trailing Stop Loss

I am new to this platform, appreciates if someone could help.

Sell Rule #1:
Rank < Buy day’s Rank
How to retrieve Ranking during the day I bought the stock?

Sell Rule #2:
I have a trailing stop loss based on candlestick formation in my real life trading, let say:
Open = Low and continue for 3 days at price $1, I buy, my stop loss is Low ($1).
After 2 weeks, Open = Low happen again for 3 days at price $1.30, my trailing stop loss change to $1.30

What do you mean by ‘and continue for 3 days’? That the open=low=$1 for 3 straight days?

Yes, open price = lowest price straight for 3 days

In the first instance, your buy rule is such that any loss from entry triggers a sell. Easy enough. In the second case…I don’t think you can do that. You can have a sell rule evaluate if the open=low, and if so…but can you save that value? I don’t know.

I don’t think there is a way to both screen for a certain criteria and then save that date. As it is, the date is relative from the current trading day(close(4) or open(-1)) but this is relative not absolute.

Maybe someone else knows how.

Hi hemmerling, thanks for your helps.

For Sell Rule#1:
How do I code it into my Sell Rule?
I saw the trading log after backtest is listed with a Ranking during my Entry, but couldn’t figure out a way to retrieve it within my Sell Rule.

For Sell Rule#2:
Could P123 Team give me some advice on this?

By adding a simple checking on candlestick formation in my Buy Rule, the result is big different even I didn’t manage to include the above Sell Rules for my Exit.

p/s: the candlestick formation I written in post#1 is just an example, not the actual criteria I am using.



For a sim only you can test with look ahead bias. Buy rule of open(-1)=low(-1). Open is the low.
You can use an entry based stop loss in the stop loss tab or use the gainpct<0 as a sell rule.

By the time 3 candlestick formation is confirmed, my Entry is already on 4th day,
let say open price gap up 5%, my Entry cost will be $1.05,
from 4th day onward as long close price not lower than $1.00 I will hold it.
So if I use gainpct < 0 or Stop Loss Tab, I would be kick out if close price go to $1.03.

Even if price up 80% become $1.80 after 3 month, my Trailing Stop Loss still maintain at $1.00, until I see the 2nd time open = low straight for 3 day at price $2.10, then I will move my Stop Loss to $2.10.

My main problem is I can’t check for my Trailing Stop Loss because P123 don’t have a place let me save my Trailing Stop Loss.

Hi P123 Team,
any possibility let us use the Trailing Stop Loss variable in Stop Loss Tab?
This should minimize your software modification time.