READ-ONLY

The forum is now a read-only archive.

For bug reports & platform questions → [email protected]

Our community lives on Discord and YouTube — come join us!

This is a template of a strategy, not a complete strategy

3 replies

Phillip van Coller

Customer, bbp_participant, community, 28 replies.

Visit profile

11 months ago #291596

Hi,

I’m having issues with some of my custom block (I assume) not being able to generate the source code like Tradestation Easylanguage.

Please see strategy attached.
Also here is the pseudo code:

 

//——————————————————————–
// Pseudo Source Code of Strategy 0.38434
//
//   Generated by StrategyQuant X Build 142 for MetaTrader
//   at 10/14/2025 13:12
//
//   Backtested on @ES_SQ / M15, 2010.01.03 – 2020.12.31
//   Backtest engine: Tradestation
//——————————————————————–
//——————————————————————–
//  Strategy Parameters
//——————————————————————–
int MagicNumber = 11111;
int ATRPeriod1 = 14;
int RSICrossPeriod1 = 6;
double PriceEntryMult1 = 0.5;
double PriceEntryMult2 = 1.6;
int ATRPeriod2 = 20;
Main chart = Current Symbol / Current TF;
//——————————————————————–
// Trading options logic
//——————————————————————–
Don’t Trade On Weekends = false (Friday 0038 – Sunday 0038);
Exit at End Of Day = false (1600);
Exit On Friday = false (1530);
LimitSignalsTimeRange = false (0600 – 1400, Exit at End: false, Orders to close: All);
LimitMaxDistanceFromMarketPrice = false;   //Limit max distance
MaxDistanceFromMarketPct = 6;   //Max distance %
MaxTradesPerDay = 0;
Min SL: 0, Max SL: 0, Min PT: 0, Max PT: 0; // in ticks/pips, 0 means unlimited
//——————————————————————–
// Trading rule: Trading signals (On Bar Open)
//——————————————————————–
LongEntrySignal = ((((Low(Main chart)[1] – High(Main chart)[8]) < (ATR(Main chart,ATRPeriod1)[1] * 0.40))
   and CustomBlock:London(){((Bar Time[1] >= GetTime(2, 0, 0))
   and (Bar Time[1] < GetTime(11, 0, 0)))})
   and Candle pattern on Main chart 1 bars back is Doji);
ShortEntrySignal = false;
LongExitSignal = ((RSI(Main chart,RSICrossPeriod1, PRICE_CLOSE)[1] crosses above 80)
   or  CustomBlock:End of Week(){((Bar Day of Week[0] = Friday)
   and (Bar Time[0] >= GetTime(15, 30, 0)))});
ShortExitSignal = false;
//——————————————————————–
// Trading rule: Long entry (On Bar Open)
//——————————————————————–
if ((LongEntrySignal
   and Not ShortEntrySignal)
   and Not LongExitSignal)
{
    // Action #1
    Open Long order at ((LowDaily(Main chart)[1] + (PriceEntryMult1 * (HighDaily(Main chart)[1] – LowDaily(Main chart)[1]))) + (PriceEntryMult2 * ATR(Main chart,ATRPeriod2)[1])) Stop;
        Duplicate trades: disabled;
        Replacing pending orders: allowed;
}
//——————————————————————–
// Trading rule: Short entry (On Bar Open)
//——————————————————————–
if ((ShortEntrySignal
   and Not LongEntrySignal)
   and Not ShortExitSignal)
{
    // Action #1
    Open Short order at Market;
        Duplicate trades: disabled;
}
//——————————————————————–
// Trading rule: Long exit (On Bar Open)
//——————————————————————–
if (LongExitSignal
   and (MarketPosition(“Current”, MagicNumber, “”) is Long))
{
    // Action #1
    Close Full position for Symbol = Current and Magic Number = MagicNumber;
}
//——————————————————————–
// Trading rule: Short exit (On Bar Open)
//——————————————————————–
if (ShortExitSignal
   and (MarketPosition(“Current”, MagicNumber, “”) is Short))
{
    // Action #1
    Close Full position for Symbol = Current and Magic Number = MagicNumber;
}
Broker: No filter
Attachments:
You must be logged in to view attached files.

0

Phillip van Coller

Customer, bbp_participant, community, 28 replies.

Visit profile

11 months ago #291599

The error:

0

Phillip van Coller

Customer, bbp_participant, community, 28 replies.

Visit profile

11 months ago #291602

Image attached.

Attachments:
You must be logged in to view attached files.

0

Phillip van Coller

Customer, bbp_participant, community, 28 replies.

Visit profile

11 months ago #291604

I was able to pinpoint the problem with OpenD() and CloseD() in one of my custom blocks.
Using those seems to cause the code generator to not work.

0

Viewing 3 replies - 1 through 3 (of 3 total)