Pembroke Pines
Experience: Beginner
Platform: NinjaTrader
Broker: Ninjatrader
Trading: Futures
Frequency: Daily
Duration: Minutes
Posts: 24 since Nov 2022
Thanks Given: 0
Thanks Received: 2
|
Hello thinkorn00b
To create a function that implements the logic of the "Tops and Bottoms" ShowMe study in Tradestation, you can follow these steps:
Define the function, let's call it checkTopPattern(), which takes the necessary parameters such as the price data and the required settings for the ShowMe study.
Inside the function, implement the logic to identify top patterns based on the input settings. This includes tracking the pivot highs and checking if the current candle closes above the highest pivot high.
Keep track of the state of the function using a boolean variable, let's call it patternDetected. Initialize it to false at the start.
Iterate through the price data, candle by candle. For each candle, check if it meets the conditions to be considered a top pattern. If it does, set patternDetected to true.
Once a top pattern is detected and patternDetected is true, the function should return true for that candle.
On the next candle, reset patternDetected back to false to start looking for new pivot highs.
You can call this checkTopPattern() function from your existing strategy code whenever you need to check for the presence of a top pattern. If the function returns True, it means a top pattern has been detected based on the input settings. Hope this help a little.
|