coding help for simple gold scalp strategy on 10min

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #245603 quote
    drabrahams747
    Participant
    New

    This strategy is a Gold Scalping System designed to trade the NYSE breakout at the close of the second 10-minute candle after the market opens – this is the decision bar.

    The strategy uses a breakout technique, entering long when the price breaks above the high of the second candle or short when it breaks below the low, with a 0.5-point entry buffer to avoid false breakouts. The system utilizes a fixed stop loss of 2.5 points and a take profit of 2 points. The strategy is limited to 1 trade per day,

    could someone help code this as Ive had issues with it so i can test it on probacktest

    .

    #245648 quote
    JS
    Participant
    Senior

    Hi,

    Try this one:

    // === Parameters ===
    once entryBuffer = 0.5
    once stopLoss = 2.5
    once takeProfit = 2.0
    
    // === NYSE time (adjust if needed) ===
    // Make sure your timezone is set correctly! NYSE opens at 15:30 CET
    marketOpenTime  = 153000
    decisionCandleEnd = 155000
    
    // === Capture second 10-min candle (decision bar) ===
    if OpenTime = decisionCandleEnd then
    decisionHigh = high
    decisionLow  = low
    entryLong = decisionHigh + entryBuffer
    entryShort = decisionLow - entryBuffer
    tradeDone = 0 // reset trade flag
    endif
    
    // === Trade Entry (1 trade per day) ===
    if not onmarket and tradeDone = 0 then
    // Long breakout
    if high > entryLong then
    buy 1 contract at market
    sl = close - stopLoss
    tp = close + takeProfit
    tradeDone = 1
    endif
    
    // Short breakout
    if low < entryShort then
    sellshort 1 contract at market
    sl = close + stopLoss
    tp = close - takeProfit
    tradeDone = 1
    endif
    endif
    
    // === Trade Management ===
    if longonmarket then
    // Take profit
    if close >= tp then
    sell at market
    endif
    // Stop loss
    if close <= sl then
    sell at market
    endif
    endif
    
    if shortonmarket then
    // Take profit
    if close <= tp then
    exitshort at market
    endif
    // Stop loss
    if close >= sl then
    exitshort at market
    endif
    endif
    
    GraphOnPrice DecisionHigh as "High"
    GraphOnPrice DecisionLow as "Low"
    Iván González and robertogozzi thanked this post
    Scherm­afbeelding-2025-04-07-om-08.31.55.jpg Scherm­afbeelding-2025-04-07-om-08.31.55.jpg
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

coding help for simple gold scalp strategy on 10min


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by JS
10 months, 2 weeks ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 04/05/2025
Status: Active
Attachments: 1 files
Logo Logo
Loading...