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!

Interpretation of code for manual trading

2 replies

Benjamin Pierce

Subscriber, bbp_participant, customer, community, sq-ultimate, 16 replies.

Visit profile

1 year ago #289347

Hello, I have a few questions about the code I’m pasting below.  I used Algowizard to make a template for a simple Donchian channel breakout strategy.  Here are my questions:

-What is SSM and LSM?

-I understand the StopLossCoef- this is how my stop loss is calculated.  But what is

double AssignVrbVleEntMlt1 = 7.5; and

double AssignVrbVleEntMlt2 = 3; ??
//——————————————————————–
// Pseudo Source Code of Strategy 0.312
//
//   Generated by StrategyQuant X Build 142 for MetaTrader
//   at 03/12/2025 16:03
//
//   Backtested on _M6E.B / D1, 1999.01.04 – 2014.12.31
//   Backtest engine: Tradestation
//——————————————————————–
//——————————————————————–
//  Strategy Parameters
//——————————————————————–
int MagicNumber = 11111;
double SSM = 1;
double LSM = 1;
int Period1 = 150;
int Period2 = 140;
int Period3 = 170;
int Period4 = 40;
double AssignVrbVleEntMlt1 = 7.5;
double StopLossCoef1 = 2.1;
double AssignVrbVleEntMlt2 = 3;
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 (2304);
Exit On Friday = false (2200);
LimitSignalsTimeRange = false (0800 – 1600, Exit at End: false, Orders to close: All);
LimitMaxDistanceFromMarketPrice = false;   //Limit max distance
MaxDistanceFromMarketPct = 6;   //Max distance %
MaxTradesPerDay = 1;
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 = ((Close(Main chart)[0] > Highest(Main chart, Period1, PRICE_CLOSE)[1])
   and (Close(Main chart)[1] < Highest(Main chart, Period1, PRICE_CLOSE)[2]));
LongExitSignal = (Close(Main chart)[0] < Lowest(Main chart, Period2, PRICE_CLOSE)[1]);
ShortEntrySignal = ((Close(Main chart)[0] < Lowest(Main chart, Period3, PRICE_CLOSE)[1])
   and (Close(Main chart)[1] > Lowest(Main chart, Period3, PRICE_CLOSE)[2]));
ShortExitSignal = (Close(Main chart)[0] > Highest(Main chart, Period4, PRICE_CLOSE)[1]);
//——————————————————————–
// Trading rule: Long entry (On Bar Open)
//——————————————————————–
if ((LongEntrySignal
   and Not ShortEntrySignal)
   and Not LongExitSignal)
{
    // Action #1
    LSM = AssignVrbVleEntMlt1;
    // Action #2
    Open Long order at Market;
        Duplicate trades: disabled;
        Stop Loss = StopLossCoef1 * ATR(20);
}
//——————————————————————–
// Trading rule: Short entry (On Bar Open)
//——————————————————————–
if ((ShortEntrySignal
   and Not LongEntrySignal)
   and Not ShortExitSignal)
{
    // Action #1
    SSM = AssignVrbVleEntMlt2;
    // Action #2
    Open Short order at Market;
        Duplicate trades: disabled;
        Stop Loss = StopLossCoef1 * ATR(20);
}
//——————————————————————–
// 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

0

Tomas Matejka

Administrator, sq-ultimate, 2 replies.

Visit profile

1 year ago #289366

LSM, SSM, AssignVrbVleEntMlt1 and AssignVrbVleEntMlt2 are assigned a value but never used.

 

0

Mayra Silva

Subscriber, bbp_participant, 1 replies.

Visit profile

1 year ago #289532

SSM – Smoothed Moving Average
LSM – Least Squares Moving Average

If Price > SSM → Consider Long Bias.

If Price < SSM → Consider Short Bias.

LSM changing direction → Early signal of possible reversal or trend acceleration.

0

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