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
등급
(16)
프로젝트
35
23%
중재
4
0% / 50%
기한 초과
2
6%
작업중
3
개발자 3
등급
(5)
프로젝트
5
0%
중재
5
0% / 40%
기한 초과
0
무료
4
개발자 4
등급
(542)
프로젝트
624
33%
중재
37
38% / 51%
기한 초과
11
2%
바쁜
5
개발자 5
등급
(31)
프로젝트
44
61%
중재
0
기한 초과
0
무료
6
개발자 6
등급
(77)
프로젝트
242
74%
중재
7
100% / 0%
기한 초과
1
0%
무료
게재됨: 1 기고글
7
개발자 7
등급
(28)
프로젝트
39
23%
중재
14
0% / 93%
기한 초과
4
10%
작업중
8
개발자 8
등급
프로젝트
0
0%
중재
0
기한 초과
0
무료
9
개발자 9
등급
(57)
프로젝트
89
43%
중재
4
0% / 100%
기한 초과
3
3%
작업중
10
개발자 10
등급
(845)
프로젝트
1447
72%
중재
119
29% / 47%
기한 초과
355
25%
작업중
게재됨: 3 기고글
11
개발자 11
등급
(69)
프로젝트
146
34%
중재
13
8% / 62%
기한 초과
26
18%
무료
게재됨: 6 코드
비슷한 주문
1. Trading Idea & Project Goal This is a Market Filter Scanner , not a trading robot. Its sole purpose is to automate the identification of high-probability price action setups across multiple symbols. The tool must scan markets, apply a strict set of objective rules to closed candles only , and alert me with a sound when a setup is found. This MVP (Minimal Viable Product) version is deliberately simplified to
## Project Summary I am hiring an experienced *MQL5 developer* to convert an existing *Heikin Ashi–based scalping strategy (currently written in Pine Script)* into a fully automated Expert Advisor for *MetaTrader 5*. The trading logic already exists. Your role is implementation, execution reliability, and engineering improvements — particularly eliminating trades during consolidation/ranging markets. This is a custom
I need a AI signal generating bot for forex trading that use the latest ai technology to track real time forex market, analyse and give signals. The bot should operate such that when i put it in a chart it will analyse the market, after several minutes it will display whether the trade is buying or selling. It should display the one minute, five minute,15minute, 30 minute, one hour, 4 hours and daily time frame
1. Objective A fully automated trading bot that: • Trades USD-quoted assets (forex pairs like EUR/USD, GBP/USD, crypto markets with USD trading pairs, and USD-denominated stocks/ETFs). • Uses real-time data to detect trends and place entries/exits based on multiple strategies. • Maximizes profit while maintaining robust risk controls and drawdown limits. 2. High-Level Architecture Components Component Purpose Data
Hello I want to convert my tradingview indicators into Ninja trader can anyone help me with it it is urgent and I will like to discuss more about it to you if you can help me Kindly do well to bid on it
I need a custom MT5 Expert Advisor with the following rules: Strategy: - Timeframe: M15 (adjustable input) - Indicators: - MACD (12,26,9) - SMA 200 as trend filter Entry rules (CLOSED candles only): - BUY: - MACD main crosses above signal on closed candle - Price close above SMA 200 - SELL: - MACD main crosses below signal on closed candle - Price close below SMA 200 General rules: - One trade at a time per
📌 JOB DESCRIPTION – FULLY AUTOMATED TRADING SYSTEM I am looking for an experienced developer to build a fully automated end-to-end trading system for MetaTrader 5. This is not an indicator-based bot and not a discretionary or black-box AI system. The system must follow a strict, deterministic rule-based trading framework that is already defined. 🎯 PROJECT GOAL Build a system where: A backend continuously evaluates
Bot007 50 - 200 USD
*Bot Name:* SupportShield *Description:* SupportShield is a cutting-edge trading bot that uses advanced technical analysis to identify key support and resistance levels in the market. By leveraging these levels, the bot provides traders with actionable insights to make informed trading decisions. *How it works:* 1. *Support Level*: The bot identifies a support level, where the price tends to bounce back or
Task Title Implement Martingale Lot Scaling Sync Between Master and Slave MT4 Trade Copier Background I am using a local master–slave trade copier setup with: 1 Master MT4 4 Slave MT4 terminals Trades are currently copied correctly (entry, direction, symbol, SL/TP). Lot size handling currently copies either: the exact master lot, or a fixed base lot defined on the slave (e.g., always 0.01 or 1.0). Problem When the
SyedAtif 30 - 40 USD
Then this EA will remain simple and clean , exactly following your core rules only: ✅ MA50 crosses Leading Span B → trade opens ✅ Opposite cross → trade closes ✅ No TP / SL ✅ Only one position at a time ✅ Entry only after candle close confirmation ✅ Final Simple MT5 Expert Advisor (English Specification) Entry Rules BUY Entry Open a Buy trade when: MA50 crosses above Leading Span B Trade is triggered only

프로젝트 정보

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