Trading strategy

명시

//@version=5  
strategy("Operator Psychology Trading Strategy with Heikin-Ashi (Auto Risk-Reward)", overlay=true, pyramiding=2, default_qty_type=strategy.fixed, default_qty_value=1)

// Check for the 3-minute timeframe
if (not (timeframe.isintraday and timeframe.period == "3"))
    runtime.error("This strategy can only be run on the 3-minute timeframe.")

// Parameters for ATR, Stop-Loss, Risk Percentage, and Sideways Market Threshold
atrLength = input.int(3, title="ATR Length")  // ATR length set to 3
riskMultiplier = input.float(3, title="Risk Multiplier for Stop-Loss")  // Updated Risk Multiplier to 3
capitalRiskPercent = input.float(2, title="Capital Risk Percentage per Trade", minval=0.1, maxval=100)  // Capital Risk set to 2%
sidewaysThreshold = input.float(1.6, title="Sideways ATR Threshold", minval=0.1)  // Updated Sideways ATR Threshold to 1.6

// Moving Average for Trend Detection
maLength = input.int(6, title="Moving Average Length")  // Updated Moving Average length to 6
ma = ta.sma(close, maLength)

// Heikin-Ashi Candle Calculation
haClose = (open + high + low + close) / 4
var haOpen = (open + close) / 2
haOpen := na(haOpen[1]) ? (open + close) / 2 : (haOpen[1] + haClose[1]) / 2
haHigh = math.max(high, math.max(haOpen, haClose))
haLow = math.min(low, math.min(haOpen, haClose))

// Calculate ATR based on Heikin-Ashi candles
atrValue = ta.atr(atrLength)

// Define the previous and current Heikin-Ashi candle values
prevHaClose = haClose[1]
prevHaHigh = haHigh[1]
prevHaLow = haLow[1]
prevHaOpen = haOpen[1]
currHaClose = haClose
currHaHigh = haHigh
currHaLow = haLow
currHaOpen = haOpen

// Calculate buy and sell volumes using Heikin-Ashi candles
prevBuyVolume = prevHaClose > prevHaOpen ? volume : 0
currBuyVolume = currHaClose > currHaOpen ? volume : 0
prevSellVolume = prevHaClose < prevHaOpen ? volume : 0
currSellVolume = currHaClose < currHaOpen ? volume : 0

// Sideways Market Condition: Check if ATR is below threshold (low volatility)
sidewaysMarket = atrValue < sidewaysThreshold

// Define Buy Signal conditions based on operator psychology using Heikin-Ashi candles and trend confirmation
buyCondition1 = currHaClose > prevHaHigh              // Heikin-Ashi close breaks previous Heikin-Ashi high
buyCondition2 = currBuyVolume > prevBuyVolume         // Current buying volume exceeds previous
buyCondition3 = prevHaClose < currHaOpen              // Previous Heikin-Ashi candle closes lower than current open
buyCondition4 = haClose > ma                          // Close price is above moving average (trend confirmation)
buySignal = buyCondition1 and buyCondition2 and buyCondition3 and buyCondition4 and not sidewaysMarket  // Avoid sideways zones

// Define Sell Signal conditions based on operator psychology using Heikin-Ashi candles and trend confirmation
sellCondition1 = currHaClose < prevHaLow               // Heikin-Ashi close breaks previous Heikin-Ashi low
sellCondition2 = currSellVolume > prevSellVolume       // Current selling volume exceeds previous
sellCondition3 = prevHaClose > currHaOpen              // Previous Heikin-Ashi candle closes higher than current open
sellCondition4 = haClose < ma                          // Close price is below moving average (trend confirmation)
sellSignal = sellCondition1 and sellCondition2 and sellCondition3 and sellCondition4 and not sidewaysMarket  // Avoid sideways zones

// Calculate Stop-Loss and Target Levels for Long and Short Positions
longStopLoss = currHaClose - (atrValue * riskMultiplier)  // Stop-loss for long position
shortStopLoss = currHaClose + (atrValue * riskMultiplier)  // Stop-loss for short position

// **Auto Risk-Reward Ratio**: The Reward (Target) is dynamically calculated based on the risk
rewardRatio = input.float(6, title="Default Risk-Reward Ratio")  // Updated Risk-Reward Ratio to 6
longTarget = currHaClose + (currHaClose - longStopLoss) * rewardRatio  // Target for long position
shortTarget = currHaClose - (shortStopLoss - currHaClose) * rewardRatio  // Target for short position

// Calculate position size based on capital risk and set to auto trade 0.01 lot for XAUUSD
capital = strategy.equity
riskPerTrade = capitalRiskPercent / 100 * capital
longPositionSize = math.max(riskPerTrade / (currHaClose - longStopLoss), 0.01)  // Minimum 0.01 lot for long position
shortPositionSize = math.max(riskPerTrade / (shortStopLoss - currHaClose), 0.01)  // Minimum 0.01 lot for short position

// Strategy Execution: Long Trades
if (buySignal)
    strategy.entry("Long", strategy.long, qty=longPositionSize)
    strategy.exit("Take Profit", "Long", limit=longTarget, stop=longStopLoss)

// Strategy Execution: Short Trades
if (sellSignal)
    strategy.entry("Short", strategy.short, qty=shortPositionSize)
    strategy.exit("Take Profit", "Short", limit=shortTarget, stop=shortStopLoss)

// Plot shapes for buy and sell signals
plotshape(series=buySignal, title="Buy Signal", location=location.belowbar, color=color.blue, style=shape.labelup, text="LONG")
plotshape(series=sellSignal, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="SHORT")

// Alert conditions for buy and sell signals
alertcondition(buySignal, title="Buy Alert", message="Buy Signal Triggered!")
alertcondition(sellSignal, title="Sell Alert", message="Sell Signal Triggered!")

// Plot the Heikin-Ashi Close price for reference
plot(haClose, color=color.gray, linewidth=1, title="Heikin-Ashi Close")

// Plot moving average for trend reference
plot(ma, color=color.orange, linewidth=1, title="Moving Average (Trend Filter)")


파일:

응답함

1
개발자 1
등급
(132)
프로젝트
178
39%
중재
4
25% / 50%
기한 초과
14
8%
무료
2
개발자 2
등급
(15)
프로젝트
34
24%
중재
4
0% / 50%
기한 초과
2
6%
작업중
3
개발자 3
등급
(5)
프로젝트
5
0%
중재
5
0% / 40%
기한 초과
0
무료
4
개발자 4
등급
(539)
프로젝트
619
33%
중재
36
36% / 53%
기한 초과
11
2%
로드됨
5
개발자 5
등급
(31)
프로젝트
44
61%
중재
0
기한 초과
0
무료
6
개발자 6
등급
(77)
프로젝트
241
73%
중재
7
100% / 0%
기한 초과
1
0%
무료
7
개발자 7
등급
(27)
프로젝트
37
24%
중재
14
0% / 93%
기한 초과
4
11%
작업중
8
개발자 8
등급
프로젝트
0
0%
중재
0
기한 초과
0
무료
9
개발자 9
등급
(57)
프로젝트
89
43%
중재
4
0% / 100%
기한 초과
3
3%
작업중
10
개발자 10
등급
(844)
프로젝트
1445
72%
중재
119
29% / 47%
기한 초과
355
25%
로드됨
게재됨: 3 기고글
11
개발자 11
등급
(69)
프로젝트
146
34%
중재
13
8% / 62%
기한 초과
26
18%
무료
게재됨: 6 코드
비슷한 주문
Hello. I am finding an experienced python developer who can implement my trading strategies into robots. I like trend-following swing trading strategies and am going to automate my idea. More details can be discussed by chatting. If you have similar working experience it can be a plus. Thanks
- Bring in your support and resistance expert to save time . - My expert already has money management , session filter , threshold based . - Also show a screen or a picture of the chart showing the support and resistance on live chart
hello great developer Looking for an experienced Web3 / crypto bot developer to build a copy-trading bot for Polymarket . The bot should track selected traders or wallets in real time and automatically replicate trades with minimal delay. Experience with Polymarket, blockchain APIs, and low-latency trading bots is required. Open to custom features and long-term collaboration. Platform: Polymarket (Web3 / API-based)
This strategy is built around the idea that price seeks liquidity, and that retail traders often get trapped around key highs and lows. Instead of entering trades before price hits liquidity, this playbook waits for the market to run stops (take liquidity) and then trade the reversal after the trap is formed. The concept is simple: buy below lows, sell above highs, but only when those lows or highs have respected
* Use Fibonacci retracement (with adjusted values) to scale entry points. * Timeframe may differ depending on the projected target; but the Fibonacci conditions remain the same * date range into consideration as well * Applicable to indices, crypto and metals. * Activate entries on the second half of my fib *Usually takes the whole week to unfold (5 - 7 days) * Timeframes to consider 5m/15m, H1/H2 The attached images
I am planning to integrate auto trading from python directly to broker terminal. Core Trading Setup Python ↔ Broker API integration Login & token management Market data (REST + WebSocket) Order placement / modification / cancellation Multi-strategy orchestration (50+) ✅ Infrastructure VPS setup (Linux preferred) Static IP handling & broker whitelisting Process supervision (systemd / supervisor) Logging, retries
Need a HFT scalping EA 30 - 100 USD
Require the development of a high-speed HFT, fully automated trading Expert Advisor (EA) for MetaTrader 5 , optimized for live trading on both Deriv and Exness . The EA must be designed for fast execution, low latency, and reliability on real-money accounts , with full compatibility across broker-specific contract specifications, tick sizes, tick values, pricing formats, and volume rules. It should automatically
Olá, preciso de um programador para montar um indicador com base na sobrevenda do estocastico, volume macd, para uma estrategia de reversão e falso rompimento com regioes de OB validos minimas e maximas de H1, H4, D1 e canais para confluencias, quero que seja didatico visualmente e com cores, sons de alertas e algum sinal de call ou put como setas indicando reversões e falsos rompimentos e continuidade
I have an issue with my ninja script and i would like you to help me straighten things I wanted to create an indicator and i have the source code already but i am getting compiling errors on my NinjaTrader And i tried fixing the error it still same I sent 3 images here for you to understand the errors and i would like to ask if you can help me fix it so i can go ahead and compile my source code. Thanks
Good day, I would like to build an automated trading system for Ninjatrader using 2 MACD, a Supertrend, and a moving average indicator. I want the option to adjust the indicator settings, the ability to trade at three different times, and the option to receive alerts. I want to get an idea of what that will cost me. It will enter trades on all blue take one contract out at a fixed point, move the stop to break even

프로젝트 정보

예산
100 - 200 USD
기한
에서 1  100 일