OPEN-SOURCE SCRIPT
Granny Strategy [rdjxyz]

This is the Granny Strategy, as described on TG Capital's Sunday Service stream.
Definitions
The Setup
*As described on the stream.
*Look for longs when price is above 50 EMA; look for shorts when price is below the 50 EMA.
Inputs
Exception Inputs
Allow some exceptions to the rigid rules
Play around with the different settings on various timeframes and instruments to find rules that work best for your strategy goals. Or just use it to find valid vs. invalid setups historically.
Will be working on adding a trailing stop loss.
Leave a comment with any bugs or ideas you have to improve the strategy.
IMPORTANT
Adjust account size, position size, commissions, etc in the properties tab for accurate results!
Definitions
- C0 - Candle 0 - the candle where the FVG start is plotted
- C1 - Candle 1 - the candle that drives the FVG
- C2 - Candle 2 - the candle where the FVG end is plotted
- C3 - Candle 3 - the entry candle (assuming all criteria are met)
- 👵🏻 - Valid setup
- 🤡 - Invalid setup
The Setup
*As described on the stream.
*Look for longs when price is above 50 EMA; look for shorts when price is below the 50 EMA.
- FVG is printed
- C2 sweeps the low of C1 and closes bullish (for longs) or sweeps the high of C1 and closes bearish (for shorts)
- C3 inverts FVG and closes below C1 open (for longs) or above C1 open (for shorts)
- If criteria above is met, position is entered on the close of C3 with stop loss at the low of C3 (for longs) or high of C3 (for shorts)
Inputs
- Time Window Filter - only look for setups within a certain range of time
- EMA length - original strategy calls for 50
- Stop loss offset - ticks to offset stop loss from low (for longs) / high (for shorts) of C3
- Risk:Reward ratio - take profit as a multiple of the stop loss size from entry
- Break even stop loss - optional, move stop loss to break even after price reaches a specific R:R; e.g. once price hits 1:1 R:R, move stop loss to break even
Exception Inputs
Allow some exceptions to the rigid rules
- Select which candle in the sequence the EMA filter is applied to (can produce different results)
- Disable EMA bias filter (will find shorts when price is above EMA and longs when price is below)
- Allow C3 to close inside of FVG (instead of completely inverting it)
- Allow C3 to close above C1 open (for longs) or below C1 open (for shorts)
- Allow C2 to close opposite of setup direction; e.g. if long, C2 is allowed to close as a bearish candle instead of bullish candle
Play around with the different settings on various timeframes and instruments to find rules that work best for your strategy goals. Or just use it to find valid vs. invalid setups historically.
Will be working on adding a trailing stop loss.
Leave a comment with any bugs or ideas you have to improve the strategy.
IMPORTANT
Adjust account size, position size, commissions, etc in the properties tab for accurate results!
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.