Code:
/*[[
Name := Vérification de Backtest 1
Author := Syl20
Link :=
www.mataf.net
Notes := Preuve d'erreur sur BuyStop
Notes := Preuve d'erreur, achat dans la même barre.
Lots := 1.00
Stop Loss := 20
Take Profit := 20
Trailing Stop := 20
]]*/
var: UT (0);// times unity of the motto
UT = period; // times of the motto in minute
// --------------------------------------
// Exclusion conditions
// --------------------------------------
If Bars < 100 then Exit;
If FreeMargin < Equity/10 then Exit;
// Correction to avoid the multi-buy in the even bar.
// If CurTime-LastTradeTime < UT*60 then Exit;// Verify if it there has a trade in the presents bar.
If TotalTrades < 1 then
// ------------
// LONG entry
// ------------
If close[5] < Low-10*Point then
SetOrder(OP_BUYSTOP,Lots,close[5],3,Ask-StopLoss*Point,Ask+TakeProfit*Point,Lime);
Exit;
/*
The correction for the purchase would be to put the purchase to the Ask always and the sale to the Bid otherwise one obtains from aberrations... As you can note it!!!
But one obtains again aberrations, therefore it is necessary to use only the Buy and the Sell.
*/