SI
SI
discoversearch

We've detected that you're using an ad content blocking browser plug-in or feature. Ads provide a critical source of revenue to the continued operation of Silicon Investor.  We ask that you disable ad blocking while on Silicon Investor in the best interests of our community.  If you are not using an ad blocker but are still receiving this message, make sure your browser's tracking protection is set to the 'standard' level.
Microcap & Penny Stocks : MY THREAD -- Ignore unavailable to you. Want to Upgrade?


To: Qone0 who wrote (139)3/14/2025 8:06:10 AM
From: Qone01 Recommendation

Recommended By
bull_dozer

  Read Replies (1) | Respond to of 143
 
// Refined NinjaTrader Strategy
using System;
using NinjaTrader.Cbi;
using NinjaTrader.Gui.Tools;
using NinjaTrader.NinjaScript;
using NinjaTrader.NinjaScript.Strategies;
namespace NinjaTrader.NinjaScript.Strategies
{
public class RefinedTradingStrategy : Strategy
{
private SMA sma50; // 50-period Simple Moving Average
private RSI rsi; // Relative Strength Index
private double fibRetracement = 0.618; // Fibonacci retracement level
private double fibExtension = 1.618; // Fibonacci extension level
private int takeProfitPoints = 10; // Take-profit target in points
private int stopLossPoints = 5; // Stop-loss in points
protected override void OnStateChange()
{
if (State == State.SetDefaults)
{
Description = "Refined strategy with fixed entry, take profit, and stop-loss points.";
Name = "RefinedTradingStrategy";
Calculate = Calculate.OnBarClose;
IsOverlay = true;
}
else if (State == State.DataLoaded)
{
sma50 = SMA(50); // Initialize SMA
rsi = RSI(14, 3); // Initialize RSI
}
}
protected override void OnBarUpdate()
{
if (CurrentBar < 50) return; // Ensure enough data for indicators
// Harmonic Pattern Entry Logic
if (Low[1] < High[2] * (1 - fibRetracement) && Close[0] > Low[1] * fibExtension)
{
EnterTradeWithTargets("HarmonicEntry");
}
// Gann Angle Entry Logic
double gannAngle = (High[1] - Low[1]) / 45; // Simplified Gann angle calculation
if (Close[0] > Low[1] + gannAngle && Close[0] > sma50[0])
{
EnterTradeWithTargets("GannEntry");
}
// Wyckoff Breakout Entry Logic
if (Close[0] > sma50[0] && Volume[0] > Volume[1] * 1.5 && rsi[0] > 50)
{
EnterTradeWithTargets("WyckoffBreakout");
}
// Elliott Impulse Wave Entry Logic
if (High[0] > High[1] && High[1] > High[2] && Low[0] > Low[1] && Low[1] > Low[2])
{
EnterTradeWithTargets("ElliottImpulse");
}
}
// Helper method to place trades with fixed stop-loss and take-profit
private void EnterTradeWithTargets(string signalName)
{
double entryPrice = Close[0];
double stopLossPrice = entryPrice - (stopLossPoints * TickSize); // Set stop-loss
double takeProfitPrice = entryPrice + (takeProfitPoints * TickSize); // Set take-profit
EnterLong(signalName); // Enter long trade
SetStopLoss(CalculationMode.Price, stopLossPrice); // Apply stop-loss
SetProfitTarget(CalculationMode.Price, takeProfitPrice); // Apply take-profit
}
}
}