PureBytes Links
Trading Reference Links
|
Input:
NumLTrd(2), {Number of long trades allowed per trading window}
NumSTrd(2); {Number of short trades allowed per trading window}
Vars:
currentbar(0,data1),
OpeningBar(0,Data1),
BuyEnable(False,Data1),
SellEnable(False,Data1),
LTrades(0),
STrades(0);
{
Detect the start of a new day
}
if Date > Date[1] then begin
OpeningBar = CurrentBar;
BuyEnable = False;
SellEnable = False;
LTrades = 0;
STrades = 0;
end;
Condition1=your buy conditions;
Condition2=your sell conditions;
{
Long Entry Logic
}
if buyenable and Condition1 then begin
Buy("FDBuy") at market;
LTrades = LTrades + 1;
end;
if LTrades >= NumLTrd then BuyEnable = False;
{
Short Entry Logic
}
if sellenable and Condition2 then begin
Sell("FDSell") at market;
STrades = STrades + 1;
end;
|