Trader4TOS
Member
The suitability of detecting large orders immediately depends on the specific time frame and trading style you are using. However, in general, shorter time frames such as intraday charts (e.g., 1-minute, 5-minute) are more suitable for detecting orders in real-time or near real-time.
When using shorter time frames, the script will analyze volume differences between consecutive bars, allowing for more immediate detection of large orders. However, it's important to note that the script's effectiveness may vary based on market liquidity, volatility, and the specific stocks or securities you are trading.
For longer time frames (e.g., daily, weekly), the script may still detect large orders, but it may not provide immediate or intraday insights since it relies on the comparison of volume differences between bars. It has many customizable features in the options menu.
Ultimately, the suitability of the script for detecting orders immediately depends on your trading preferences, time frame, and the specific requirements of your trading strategy. You may need to experiment with different time frames and adjust the script parameters to align with your trading goals.
The Market Structure indicator combines the Order Block concept with the Zero Lag Zigzag indicator. Let's go through the different color-coded prices and their interpretations:
When using shorter time frames, the script will analyze volume differences between consecutive bars, allowing for more immediate detection of large orders. However, it's important to note that the script's effectiveness may vary based on market liquidity, volatility, and the specific stocks or securities you are trading.
For longer time frames (e.g., daily, weekly), the script may still detect large orders, but it may not provide immediate or intraday insights since it relies on the comparison of volume differences between bars. It has many customizable features in the options menu.
Ultimately, the suitability of the script for detecting orders immediately depends on your trading preferences, time frame, and the specific requirements of your trading strategy. You may need to experiment with different time frames and adjust the script parameters to align with your trading goals.
The Market Structure indicator combines the Order Block concept with the Zero Lag Zigzag indicator. Let's go through the different color-coded prices and their interpretations:
- Bullish Order Blocks:
- ObBull1 (White Values Below): This plots the low of a bullish order block. It represents a potential support level where buyers have shown strength, pushing the price higher.
- bull1 (White Dashes): This plots the high of a bullish order block. It represents a potential resistance level where sellers may enter the market and push the price lower.
- bull2 (White Values): This plots the low of a bullish order block. It complements the bullish order block's high (bull1) and indicates a support level.
- ObBullAvg1 (White Dashes): This plots the average price (midpoint) of a bullish order block. It can serve as a reference point for evaluating the overall strength or weakness of the bullish order block.
- Bearish Order Blocks:
- ObBear1 (Values Above): This plots the high of a bearish order block. It represents a potential resistance level where sellers have shown strength, pushing the price lower.
- bear1 (Dashes): This plots the low of a bearish order block. It represents a potential support level where buyers may enter the market and push the price higher.
- bear2 (Values): This plots the high of a bearish order block. It complements the bearish order block's low (bear1) and indicates a resistance level.
- ObBearAvg1 (Dashes): This plots the average price (midpoint) of a bearish order block. It can serve as a reference point for evaluating the overall strength or weakness of the bearish order block.
- Zero Lag Zigzag:
- obStartPlot (Cyan): This plots the start points of the identified order blocks based on the Zero Lag Zigzag indicator. It indicates potential turning points where price shifts from a downtrend to an uptrend.
- obEndPlot (Magenta): This plots the end points of the identified order blocks based on the Zero Lag Zigzag indicator. It indicates potential turning points where price shifts from an uptrend to a downtrend.
- Bullish Order Block Channel: It is shown as a light green cloud and represents the range between the start and end points of the bullish order block.
- Bearish Order Block Channel: It is shown as a pink cloud and represents the range between the start and end points of the bearish order block.
Ruby:
#converted by Trader4TOS
# Order Block Indicator with Zero Lag Zigzag
declare lower;
input ShowCloud = yes;
input periods = 5; # "Relevant Periods to identify OB"
input threshold = 0.0; # "Min. Percent move to identify OB"
input useWicks = no; # "Use whole range [High/Low] for OB marking?" )
input showBullChannel = yes; # "Show latest Bullish Channel?"
input showBearChannel = yes; # "Show latest Bearish Channel?"
# Zero Lag Zigzag for structure
def highBar = high > high[1];
def lowBar = low < low[1];
def highZigzag = if highBar and !highBar[1] then high else if highBar and highBar[1] then Max(highZigzag[1], high) else Double.NaN;
def lowZigzag = if lowBar and !lowBar[1] then low else if lowBar and lowBar[1] then Min(lowZigzag[1], low) else Double.NaN;
def zigzag = if !IsNaN(highZigzag) then highZigzag else lowZigzag;
def isPeak = !IsNaN(highZigzag);
def isTrough = !IsNaN(lowZigzag);
# Calculate order blocks
def obStart = if isPeak and !isPeak[1] then highZigzag else Double.NaN;
def obEnd = if isTrough and !isTrough[1] then lowZigzag else Double.NaN;
# Order block filter
def highValue = high;
def lowValue = low;
def blockThreshold = threshold * (highValue - lowValue);
def isObStart = highValue - lowValue > blockThreshold;
def isObEnd = lowValue - highValue < -blockThreshold;
# Declare variables
def na = Double.NaN;
def ob_period = periods + 1;
def absmove = ((AbsValue(close[ob_period] - close[1])) / close[ob_period]) * 100;
def relmove = absmove >= threshold;
def bullishOB = close[ob_period] < open[ob_period];
def upcandles = Sum(close > open, periods + 1);
def OB_bull = bullishOB and upcandles == periods and relmove;
def OB_bull_high = if OB_bull then if useWicks then high[ob_period] else open[ob_period] else na;
def OB_bull_low = if OB_bull then low[ob_period] else na;
def OB_bull_avg = (OB_bull_high + OB_bull_low) / 2;
def bearishOB = close[ob_period] > open[ob_period];
def downcandles = Sum(close < open, periods + 1);
def OB_bear = bearishOB and downcandles == periods and relmove;
def OB_bear_high = if OB_bear then high[ob_period] else na;
def OB_bear_low = if OB_bear then if useWicks then low[ob_period] else open[ob_period] else na;
def OB_bear_avg = (OB_bear_low + OB_bear_high) / 2;
# Plotting
plot ObBull1 = if OB_bull then low else Double.NaN; #"Bullish OB"
ObBull1.SetPaintingStrategy(PaintingStrategy.VALUES_BELOW);
ObBull1.SetDefaultColor(Color.WHITE);
ObBull1.SetLineWeight(2);
plot bull1 = if OB_bull_high then if useWicks then high else open else na;
bull1.SetPaintingStrategy(PaintingStrategy.DASHES);
bull1.SetDefaultColor(Color.WHITE);
bull1.SetLineWeight(2);
plot bull2 = if OB_bull_low then low else Double.NaN; #"Bullish OB Low"
bull2.SetPaintingStrategy(PaintingStrategy.DASHES);
bull2.SetDefaultColor(Color.WHITE);
bull2.SetLineWeight(2);
plot ObBullAvg1 = (bull1 + bull2) / 2; #"Bullish OB Average"
ObBullAvg1.SetPaintingStrategy(PaintingStrategy.DASHES);
ObBullAvg1.SetDefaultColor(Color.WHITE);
ObBullAvg1.SetLineWeight(2);
plot ObBear1 = if OB_bear then high else Double.NaN; # "Bearish OB"
ObBear1.SetPaintingStrategy(PaintingStrategy.VALUES_ABOVE);
ObBear1.SetDefaultColor(CreateColor(33,150,243));
ObBear1.SetLineWeight(2);
plot bear1 = if OB_bear_low then if useWicks then low else open else na;
bear1.SetPaintingStrategy(PaintingStrategy.DASHES);
bear1.SetDefaultColor(CreateColor(33,150,243));
bear1.SetLineWeight(2);
plot bear2 = if OB_bear_high then high else Double.NaN; # "Bearish OB High"
bear2.SetPaintingStrategy(PaintingStrategy.DASHES);
bear2.SetDefaultColor(CreateColor(33,150,243));
bear2.SetLineWeight(2);
plot ObBearAvg1 = (bear1 + bear2) / 2; #"Bearish OB Average"
ObBearAvg1.SetPaintingStrategy(PaintingStrategy.DASHES);
ObBearAvg1.SetDefaultColor(CreateColor(33,150,243));
ObBearAvg1.SetLineWeight(2);
# Zero Lag Zigzag Plots
plot obStartPlot = obStart;
plot obEndPlot = obEnd;
obStartPlot.SetDefaultColor(Color.CYAN);
obEndPlot.SetDefaultColor(Color.MAGENTA);
# Order Block Filtered by Zero Lag Zigzag
plot filteredObStart = if isObStart then obStart else Double.NaN;
plot filteredObEnd = if isObEnd then obEnd else Double.NaN;
filteredObStart.SetDefaultColor(Color.GREEN);
filteredObEnd.SetDefaultColor(Color.RED);
# Bullish Order Block Channels
def BullHLine = if ShowCloud and filteredObStart == filteredObStart[1] then filteredObStart else Double.NaN;
def BullLLine = if ShowCloud and filteredObEnd == filteredObEnd[1] then filteredObEnd else Double.NaN;
def BullALine = ObBullAvg1;
AddCloud(BullHLine, BullALine, Color.Light_Green);
AddCloud(BullLLine, BullALine, Color.PINK);
# Bearish Order Block Channels
def BearHLine = if ShowCloud and filteredObEnd == filteredObEnd[1] then filteredObEnd else Double.NaN;
def BearLLine = if ShowCloud and filteredObStart == filteredObStart[1] then filteredObStart else Double.NaN;
def BearALine = ObBearAvg1;
AddCloud(BearLLine, BearALine, Color.PINK);
AddCloud(BearHLine, BearALine, Color.Light_Green);
Last edited: