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:
-I understand the StopLossCoef- this is how my stop loss is calculated. But what is
//——————————————————————–
// 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;
メインチャート = 現在のシンボル / 現在の TF;
//——————————————————————–
//取引オプションのロジック
//——————————————————————–
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; // ticks/pips単位で、0は無制限です
//——————————————————————–
// 取引ルール:取引シグナル(バーオープン時)
//——————————————————————–
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]);
//——————————————————————–
// 取引ルール:ロングエントリー(バーオープン時)
//——————————————————————–
if ((LongEntrySignal
そして、Not ShortEntrySignal)
and Not LongExitSignal)
{
// アクション #1
LSM = AssignVrbVleEntMlt1;
// アクション #2
マーケットでロング注文を開設する;;
重複した取引:無効化済み;;
Stop Loss = StopLossCoef1 * ATR(20);
}
//——————————————————————–
// 取引ルール:ショートエントリー(バーオープン時)
//——————————————————————–
if ((ShortEntrySignal
そして、LongEntrySignal)
and Not ShortExitSignal)
{
// アクション #1
SSM = AssignVrbVleEntMlt2;
// アクション #2
マーケットでショートオーダーを開く;;
重複した取引:無効化済み;;
Stop Loss = StopLossCoef1 * ATR(20);
}
//——————————————————————–
// 取引ルール:ロング・エグジット(バーオープン時)
//——————————————————————–
if (LongExitSignal
and (MarketPosition(“Current”, MagicNumber, “”) is Long))
{
// アクション #1
Close Full position for Symbol = Current and Magic Number = MagicNumber;
}
//——————————————————————–
// 取引ルール:ショート・エグジット(バーオープン時)
//——————————————————————–
if (ShortExitSignal
and (MarketPosition(“Current”, MagicNumber, “”) is Short))
{
// アクション #1
Close Full position for Symbol = Current and Magic Number = MagicNumber;
}
Broker: No filter