In this article, we will discuss how to write any conditions in Streak.
Let us first understand the basics of the platform before heading over to creating any conditions.
Streak uses Open, High, Low, and Close data for running backtests on strategies and scanner. Hence, we can refer to any candle easily. It is also important to understand that the same syntax is used for writing conditions for Scanner and strategies.
Creating OHLC-based conditions
For example, if I want to create a scanner for filtering out stock whose current candle is Green then we can use this condition-
Close(0) higher then Open(0)
This condition will do exactly what we want i.e. filter our stocks whose current candle is Green. The numbers that are mentioned within brackets are Offsets.
Now, you can try creating a scanner for filtering out stocks whose current candle is Red.
Now let us understand how to create a condition for filtering out stocks whose previous candle is Green. To do this we will just write
Close(1) higher then Open(1)
How about conditions for a condition for previous to the previous candle that is green.
Close(2) higher then Open(2)
So as we go back we will increase the offset.
Creating indicator-based conditions
The same rule is also applicable for creating a crossover condition. If we want to filter out stocks on which there was a crossover in the current candle, then the offset should be 0. For Example,
Let us now create another condition where the current candle Close has crossed above EMA 20 and in the same candle the RSI value is higher than 60.
If you read through and follow these steps, your skill in using the platform and knowledge of systematic trading will grow quickly, and soon it will all become intuitive.
If you have any queries/feedback, please write to [email protected]