ежели полностью билдеровская то так
///////// Установки аккаунта ///////////
Ticker="EESR";
TickerID=1;
Classcode="EQBR";
Seccode="EESR";
Account="L01-00000000";
Lots=1;
FileName="e:/trading/amibroker/trans.tri"; // слэши прямые!!!
Otstup=1.5; // в процентах
////////// Правила системы ///////////////
n1=17;
m1=MA(C,n1);
MH=IIf(Ref(C,-1)>H,Ref(C,-1),H);
ML=IIf(Ref(C,-1)<L,Ref(C,-1),L);
tru=mh-mL;
R=WMA(tru,10)*0.5;
ln=IIf(C>Ref(C,-1),M1-r,if(C<Ref(C,-1),M1+r,m1));
Buy=(C>Ref(ln,0));
Sell=(C<Ref(ln,0));
////// Убираем лишние сигналы /////////////
Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);
Short=ExRem(Short,Cover);
Cover=ExRem(Cover,Short);
///////////// Рисуем всякое ///////////////
Plot(C,"price",1,128);
PlotShapes(IIf(Buy,shapeUpArrow,0),5,0,Graph0,-15);
PlotShapes(IIf(Sell,shapeDownArrow,0),4,0,Graph0,-15);
PlotShapes(IIf(Cover,shapeHollowUpArrow,0),5,0,Graph0,-15);
PlotShapes(IIf(Short,shapeHollowDownArrow,0),4,0,Graph0,-15);
//////////// Формируем транзакцию.//////////////
////////////////////////////////////////////////
//////// !!!!СЮДА РУКАМИ НЕ ЛАЗИТЬ!!!! /////////
////////////////////////////////////////////////
if ((BarCount>1)AND(Name()==Ticker)AND((Buy[BarCount-1]==1)OR(Sell[BarCount-1]==1)OR(Buy[BarCount-1]==1)OR(Cover[BarCount-1]==1))) {
ifbuy=IIf((Buy[BarCount-1]==1)OR(Cover[BarCount-1]==1),1,0);
k=IIf(ifbuy,Buy[BarCount-1]+Cover[BarCount-1],Short[BarCount-1]+Sell[BarCount-1]);
if (ifbuy) { Oper="B"; } else { Oper="S"; }
price=IIf(ifbuy,(1+Otstup/100)*Close[BarCount-1],(1-Otstup/100)*Close[BarCount-1]);
transid=StrFormat("TRANS_ID=%g%g;",TickerID,BarIndex());
str=StrFormat(transid+"PRICE=%1.3f;OPERATION="+Oper+";CLASSCODE="+Classcode+"; ACTION=NEW_ORDER; TYPE=L; SECCODE="+Seccode+"; ACCOUNT="+Account+";QUANTITY=%g;",price,Lots*k);
f=fopen(FileName,"r");
found=0;
if (f) {
while (!feof(f)) {
s=fgets(f);
if (StrFind(s,transid)>0) {
found=1;
}
}
fclose(f);
}
if (found==0) {
f=fopen(FileName,"a");
if (f) {
fputs(str+"\n",f);
fclose(f);
}
}
}