Debugging exit 2 which use stochastic (simple logic)

MQL5 지표 EA

작업 종료됨

실행 시간 9 분
고객의 피드백
developer deliver the job according to my need
피고용인의 피드백
Thank you!

명시

1) Core strategy logic (state machine)

States:

  • BEGINNING_00 (idle)

  • SETUP_00 → SETUP_01 → SETUP_02 → SETUP_03

  • SELL mirror required

Donchian touch triggers:

  • BUY_SETUP_00 triggers ONLY when price touches Donchian LOW

  • SELL_SETUP_00 triggers ONLY when price touches Donchian HIGH

  • Special case: if a candle touches BOTH Donchian high and low, use WAD trend on that candle to decide BUY vs SELL on that candle.

Restart-on-touch (important):

  • If there is no position at the close of candle n, and candle n touches Donchian, then the setup must restart to Setup_00 from candle n (even if previously in Setup_01/02/03).

  • This affects which candle is the “first setup candle” and therefore affects fixed cut-loss, retracement reference, and TP1 base.

Valid setup bar count rules:

  • setup candle t, t+1, t+2, t+3 are valid setup candles

  • t+4 is last chance for a pending stop order fill (same as Python logic)

Fixed stop loss rule (big requirement):

  • In SETUP_01, the cut loss (SL) must be fixed at the FIRST Setup01 candle.

  • Entry trigger level can trail each new setup candle.

  • Intrabar special case:

    • If price breaks the stop-loss side first (e.g., long breaks below stop level) then breaks the trigger level later in the same candle, then the SL is adjusted to the new extreme (and sizing adjusted if needed). Mirror for short.

Entry types (user selectable)
A) Normal stop entry:

  • Long: Buy Stop at setup candle High + 1 pip + spread (bid-stream model)

  • Short: Sell Stop at setup candle Low - 1 pip (bid-stream model)

B) Retracement entry:

  • Virtual breakout trigger starts retrace logic when breakout trigger is hit

  • Long: Buy Limit at % retracement from swing high toward swing ref

  • Short: Sell Limit at % retracement from swing low toward swing ref

  • CAP rule:

    • Long: if limit > breakout stop-entry price, cap it at breakout stop-entry

    • Short: if limit < breakout stop-entry price, cap it at breakout stop-entry

TP1 / TP2 exits
Two-position hedging mode:

  • At entry, open two separate positions:

    • TP1 leg = 50% volume, has server-side TP at TP1

    • Runner leg = 50% volume, no TP; TP2 logic activates only after TP1 is closed

  • Preferred over partial close

TP1:

  • Default TP1 = 1R, but in retracement mode TP1 is based on virtual breakout entry (not the retrace fill price)

TP2 method A — Stochastic trailing (this is the main area that still has issues):
Scanning start:

  • If TP1 hits on candle t, start scanning TP2 on candle t+1

Activation (whichever happens first after scanning starts):

  • Long: %K ≥ 80 OR %K crosses below %D

  • Short: %K ≤ 20 OR %K crosses above %D
    Important:

  • If TP1 hit and %K is already beyond threshold when scanning starts, activate immediately (no need to cross into it).

Trailing start:

  • If activation happens on candle a, trailing begins on candle a+1:

    • Long: stop = low(a) − 1 pip (applied from a+1 onward)

    • Short: stop = high(a) + 1 pip (applied from a+1 onward)

  • Tighten-only trailing (never loosens)

TP2 method B — PSAR trailing:

  • PSAR(t-1) trailing after TP1 closed

  • Freeze when PSAR flips to wrong side; resume when PSAR flips back
    (PSAR seems okay)

Risk / sizing:

  • Position size is risk n% of capital m (both inputs)

  • For JPY pairs etc, sizing uses OrderCalcProfit-based calculation to avoid tick-value conversion issues

Execution model:

  • Bid-stream core logic

  • Spread adjustments applied where required (e.g., buy entries, sell SL/TP, etc.)

2) What’s currently wrong

Most state machine is correct now, but TP2 Stochastic trailing sometimes:

  • does not activate when it should

  • or trails using the wrong candle reference

  • or appears inconsistent (sometimes correct, sometimes wrong)

I suspect a combination of:

  • activation gating timing (TP1 close time vs when EA detects it)

  • bar indexing / shift

  • position selection context (PositionSelectByTicket affecting subsequent PositionGet* calls)

  • SL modify failures due to stops/freeze (needs explicit logging)


응답함

1
개발자 1
등급
(1)
프로젝트
0
0%
중재
2
0% / 100%
기한 초과
0
무료
2
개발자 2
등급
(1)
프로젝트
2
0%
중재
1
0% / 100%
기한 초과
0
무료
게재됨: 2 코드
3
개발자 3
등급
(2)
프로젝트
3
0%
중재
1
0% / 0%
기한 초과
2
67%
무료
4
개발자 4
등급
(3)
프로젝트
1
0%
중재
5
0% / 100%
기한 초과
0
무료
5
개발자 5
등급
프로젝트
0
0%
중재
0
기한 초과
0
무료
6
개발자 6
등급
프로젝트
0
0%
중재
0
기한 초과
0
무료
7
개발자 7
등급
프로젝트
0
0%
중재
0
기한 초과
0
무료
8
개발자 8
등급
(318)
프로젝트
565
35%
중재
81
31% / 44%
기한 초과
204
36%
무료
9
개발자 9
등급
(7)
프로젝트
5
0%
중재
5
0% / 80%
기한 초과
1
20%
작업중
10
개발자 10
등급
(14)
프로젝트
27
41%
중재
3
0% / 67%
기한 초과
6
22%
작업중
11
개발자 11
등급
(16)
프로젝트
35
23%
중재
4
0% / 50%
기한 초과
2
6%
작업중
12
개발자 12
등급
(4)
프로젝트
3
33%
중재
2
0% / 100%
기한 초과
0
무료
13
개발자 13
등급
(17)
프로젝트
21
14%
중재
8
38% / 38%
기한 초과
3
14%
로드됨
14
개발자 14
등급
프로젝트
2
0%
중재
0
기한 초과
1
50%
무료
15
개발자 15
등급
프로젝트
0
0%
중재
0
기한 초과
0
무료
16
개발자 16
등급
(13)
프로젝트
20
40%
중재
3
0% / 67%
기한 초과
3
15%
무료
17
개발자 17
등급
(6)
프로젝트
7
14%
중재
1
0% / 100%
기한 초과
1
14%
무료
18
개발자 18
등급
(645)
프로젝트
872
48%
중재
29
38% / 17%
기한 초과
63
7%
무료
19
개발자 19
등급
(22)
프로젝트
29
3%
중재
4
25% / 0%
기한 초과
3
10%
작업중
20
개발자 20
등급
(611)
프로젝트
711
33%
중재
45
49% / 42%
기한 초과
14
2%
작업중
21
개발자 21
등급
(258)
프로젝트
267
30%
중재
0
기한 초과
3
1%
작업중
게재됨: 2 코드
22
개발자 22
등급
(8)
프로젝트
14
21%
중재
2
0% / 50%
기한 초과
3
21%
작업중
23
개발자 23
등급
프로젝트
0
0%
중재
0
기한 초과
0
무료
24
개발자 24
등급
(10)
프로젝트
14
43%
중재
0
기한 초과
3
21%
무료
25
개발자 25
등급
(21)
프로젝트
27
7%
중재
9
33% / 33%
기한 초과
1
4%
작업중
26
개발자 26
등급
프로젝트
0
0%
중재
0
기한 초과
0
작업중
게재됨: 16 기고글, 2 코드
비슷한 주문
I have a EA/indicator that I want built. I should say 1st off dont know how to code myself so I will be using AI to verify that the source code is complete and matches the documents spec or if better so if you can not truly do the job do not waste either of out time. This is a idea I came.up wit and used AI to produce a framework for it.... and of course AI isn't 100% accurate so I need a knowledgeable quantitative
TumiiFX 30 - 20000 USD
1. Use two EMAs: 20 and 50. If EMA 20 is above EMA 50 → uptrend (look for buys) If EMA 20 is below EMA 50 → downtrend (look for sells) 2. Wait for a pullback into the area between the two EMAs. - For buys: price must touch or move between EMA 20 and EMA 50 during the last few candles. - For stils: same idea, but in a downtrend. 3. Entry signal: Buy: a bullish engulfing candle in an uptrend after the pullback
I am looking for an experienced MQL4 developer to build a professional High-Frequency Trading (HFT) / Low-Latency Expert Advisor for MetaTrader 4 (MT4) . The EA will be deployed on an IC Markets Live account and should be optimized for the fastest possible execution using a low-latency VPS located in LD4 or NY4 . The primary instruments will be US30 and XAUUSD (Gold) . The goal is to create an EA capable of
A robot 50+ USD
HIGH-FREQUENCY M5/M15 CONCURRENT ENTRY SNIPER import time class HighFrequencySniper: def __init__(self): self.target_profit = 25.00 # Targeted Delta Move self.max_execution_time = 3600 # 1 Hour Sandbox (Seconds) self.lot_allocation = "CALIBRATED_TO_RISK" def execute_hft_scan(self, current_price, m5_rsi, m15_order_block): print(f"[SCANNING] Current Kernel Metric: ${current_price:.2f
I need a trading bot, please i need this project urgently and when messaing me kindly send me samples of past works and dont forget i need the project to be done as soon as possible
A lightweight MT5 chart overlay displaying total floating P&L, average entry price, combined lot size, and current symbol exposure as a percentage of account balance, all updating in real time with color-coded profit/loss indicators, delivered with clean object-oriented source code and no DLL dependencies
QUIERO CONSEGUIR EL CODIGO FUENTE DE ESTE INDICADOR QUE ME GUSTA MUCHO TAMBIEN TIENE EL NOMBRE DE ET BANDS O ENTRY EXIT TIMING . no se los componentes pero estas son las imagenes. que mejor lo describen
I am looking to convert my existing TradingView Pine Script (v5) strategy into an MQL5 Expert Advisor (EA) for MetaTrader 5. Strategy Details: Asset: Gold (XAUUSD) Timeframe: 15-minute Strategy Logic: The strategy is based on a breakout concept. Anchor Candle: The base calculation starts from the Specified Candle Entry Window: The EA should only look for entries As Per Indicator Risk Management: The strategy
I want to find a Developer to perform this work and settle payments in this Application. I undertake not to communicate with Applicants anywhere else except this Application, including third-party messengers, personal correspondence or emails. I understand that violators will be banned from publishing Orders in the Freelance
Akram boushaba 30 - 500 USD
مرحبا كيف حالكم انا اكرم مهتم بالتداول احاول ان اصمم برنامج روبوت قادر على التداول من تلقاء نفسه من يمكنه ان يساعدني او يعلمني كيف استطيع فهل ذلك وسأكون ممتناً له وشكرا لكم

프로젝트 정보

예산
30 - 100 USD