OPEN-SOURCE SCRIPT

HA Daily Bias & EMA Setup

175
Disclaimer

This indicator is inspired by the trading concepts discussed by Animesh K in "Learn Dual Edge Trading and Mindset."

This indicator is an independent implementation of selected concepts and should not be considered an official version of his strategy.

Trading involves risk. This indicator is intended as a decision-support tool and does not guarantee profitable trades.

Indicator Objective

The purpose of this indicator is to combine:

Daily Heikin Ashi Trend Bias
34 EMA Dynamic Trend Levels
Entry Confirmation
Exit Confirmation
Trend Filtering

to provide a clean trend-following trading system.

The indicator attempts to keep traders aligned with the higher timeframe trend while using the current timeframe for entries.

Core Trading Logic

The strategy is built around two ideas:

Determine the higher timeframe market bias.
Only take trades in the direction of that bias.

Instead of predicting reversals, the indicator follows momentum.

Daily Heikin Ashi Bias

The indicator first checks the previous day's Heikin Ashi candle.

Bullish Bias

Previous HA Close > Previous HA Open

Market Bias = Bullish

Only LONG trades are allowed.

Bearish Bias

Previous HA Close < Previous HA Open

Market Bias = Bearish

Only SHORT trades are allowed.

Neutral

If neither condition exists,

No directional bias exists.

Daily Support and Resistance

The indicator plots:

Previous Daily HA High

Previous Daily HA Low

These become important reference levels for:

Support
Resistance
Trend continuation
Risk management

Green Dots

= Previous HA Low

Red Dots

= Previous HA High

EMA Setup

The indicator uses two separate EMAs.

EMA 1

Length: 34

Default Source:

High

Purpose:

Bullish confirmation.

EMA 2

Length: 34

Default Source:

Low

Purpose:

Bearish confirmation.

Long Entry Rules

A LONG signal appears only when all conditions are true.

Condition 1

Daily Bias = Bullish

AND

Condition 2

Previous candle crosses above EMA High

AND

Condition 3

Current candle closes above EMA High

If all three conditions are satisfied,

A LONG label is printed.

Long Exit

The position exits when

Previous candle crosses below EMA Low

AND

Current candle closes below EMA Low

EXIT label appears.

Short Entry Rules

A SHORT signal appears only when:

Daily Bias = Bearish

AND

Previous candle crosses below EMA Low

AND

Current candle closes below EMA Low

SHORT label appears.

Short Exit

Exit occurs when

Previous candle crosses above EMA High

AND

Current candle closes above EMA High

EXIT label appears.

Signal Filtering

The indicator contains a built-in state management system.

Possible states:

Flat

Long

Short

This prevents duplicate entries.

Example:

LONG

LONG

LONG

LONG

Instead, only the first LONG signal is displayed until an EXIT occurs.

Likewise,

SHORT

SHORT

SHORT

SHORT

Only one SHORT signal is displayed.

Historical Signals

Option:

Show Historical Signals

ON

Displays every historical signal.

OFF

Displays only the latest signal.

Useful for clean charts.

Dashboard

The dashboard displays:

Previous Day HA Bias

Bullish

Bearish

Neutral

and

Previous HA Support Level

User Inputs
EMA Settings
Setting Default
EMA Length 34
EMA High Source High
EMA Low Source Low
Style Settings
Option Description
Show Daily HA Levels Display previous HA High and Low
Show Historical Signals Display all signals
Filter Consecutive Signals Prevent repeated LONG or SHORT signals
Recommended Timeframes

The indicator works best on:

5 Minute
15 Minute
30 Minute
1 Hour
4 Hour

The Daily Heikin Ashi bias remains constant throughout the trading day while entries are generated from the selected chart timeframe.

Suggested Workflow
Step 1

Determine Daily Bias.

If Bullish

Only look for LONG trades.

If Bearish

Only look for SHORT trades.

Step 2

Wait for EMA confirmation.

Do not anticipate the signal.

Step 3

Enter only after the label appears.

Step 4

Allow the trend to continue.

Step 5

Exit only when the opposite EMA confirmation occurs.

Risk Management Suggestions

Although this indicator generates entry and exit signals, every trade should include predefined risk controls.

Common approaches include:

Risk a fixed percentage of account equity per trade (e.g., 1–2%).
Place a protective stop below the recent swing low for long trades or above the recent swing high for short trades.
Consider taking partial profits at predetermined risk-reward levels while allowing the remainder to follow the exit signal.
Avoid forcing trades when the market is range-bound or during unusually low liquidity.
Best Market Conditions

This indicator generally performs best in:

Trending markets
Strong directional momentum
Stocks, ETFs, Index Futures, and Forex pairs with sustained trends

It may generate more false signals during sideways or choppy markets.

Indicator Summary
Feature Description
Higher Timeframe Filter Previous Day Heikin Ashi Bias
Trend Filter 34 EMA (High) & 34 EMA (Low)
Long Entries Bullish bias + EMA breakout confirmation
Short Entries Bearish bias + EMA breakdown confirmation
Exits Opposite EMA confirmation
Daily Levels Previous HA High & Low
Dashboard Current Daily Bias and HA Support
Signal Filter Prevents duplicate consecutive signals

免責事項

これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。