Einzelnen Beitrag anzeigen
  #1 (permalink)  
Alt 08.01.16
carnap carnap ist offline
Neues Mitglied
 
Registriert seit: Aug 2015
Beiträge: 12
carnap befindet sich auf einem aufstrebenden Ast
Standard Cannot set indicator buffers!

Habe versucht den T3MA in einem EA als custom indicator zu verwenden.
Bekomme beim Backtest die obige Meldung bezüglich indicator buffer:
Hier der Code bis zur Orderaufgabe.

#property copyright "xxx"
#property link ""
#property version "1.00"
//#property strict

extern bool Alarmset=true; //T3MA Alarm box
int infoversand = 0;

double upbuffer[500]; // array buffer for xup signal
double dnbuffer[500]; // array buffer for xdwn signal
int sep;

extern int MaxOrdersProTag = 1 ;
extern double Lots = 0.1;
int aufgegebeneOrders = 0;
int signal;
int ticket;
extern bool TrailingStoppNutzen = 1;
extern int TrailStarten = 40;
extern int TrailAbstand = 30;
extern int Stopp = 80;
extern int Kursziel = 70;
extern int MagicNumber = 4526;
extern double oben= 100;
extern double unten= 99;



//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//indicators

#property indicator_chart_window //T3MA Alarm



SetIndexStyle(0,DRAW_ARROW,2);
SetIndexArrow(0,233); //This is buy signal
SetIndexBuffer(0, upbuffer);

SetIndexStyle(1,DRAW_ARROW,2);
SetIndexArrow(1,234); //This is short signal
SetIndexBuffer(1,dnbuffer);

if(Symbol()=="EURUSD"){sep=40;} //seperator space in points for arrow
if(Symbol()=="USDCHF"){sep=30;}
if(Symbol()=="USDJPY"){sep=30;}
if(Symbol()=="GBPUSD"){sep=30;}
if(Symbol()=="EURJPY"){sep=200;}
if(Symbol()=="GBPJPY"){sep=120;}
if(Symbol()=="AUDUSD"){sep=120;}
if(Symbol()=="EUREX.FDX"){sep=2000;}
if(Symbol()=="CME.ES"){sep=150;}

return(0);
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---

}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{

//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
// int counted_bars=IndicatorCounted();
double ax0[500];
double ax1[500];
double ax2[500];
int xdown,xup;
for(int cnt=200;cnt>=0;cnt--)
{
ax0[cnt]=iCustom(NULL,0,"T3MA",4,1.5,cnt); //ax0,1,2 for determine turning point of T3MA
ax1[cnt+1]=iCustom(NULL,0,"T3MA",4,1.5,cnt+1);
ax2[cnt+2]=iCustom(NULL,0,"T3MA",4,1.5,cnt+2);

if(ax0[cnt]-ax1[cnt+1]<0 && ax1[cnt+1]-ax2[cnt+2]>0){xdown=1;} else {xdown=0;} //definition for turning point
if(ax0[cnt]-ax1[cnt+1]>0 && ax1[cnt+1]-ax2[cnt+2]<0){xup=1;} else {xup=0;}

if(xdown==1){dnbuffer[cnt+1]=High[cnt+1]+(sep*Point);} //setting arrow down above High
if(xup==1){upbuffer[cnt+1]=Low[cnt+1]-(sep*Point);} //setting arrow up below Low
}
//

if(xup==1 && Alarmset && infoversand == 0){
Alert (Symbol()," ",Period()," STOCH-ALARM 3 >> BUY ");
infoversand = 1;
}

if(xdown==1 && Alarmset && infoversand == 0){
Alert (Symbol()," ",Period()," STOCH-ALARM 3 >> SELL ");
infoversand = 1;
}

double MomentumFilter = iMomentum(NULL,0,14,PRICE_CLOSE,1);

//+------------------------------------------------------------------+
//| determine signal |
//+------------------------------------------------------------------+

if (xup=1 && (MomentumFilter > oben)) {
signal = 1;
}

if (xup=0 && (MomentumFilter < oben)) {
signal = 0;
}


if (xdown=1 && (MomentumFilter < unten)){
signal = -1;
}

if (xdown=0 && (MomentumFilter > unten)){
signal = 0;
}

//+------------------------------------------------------------------+
//| placing orders |
//+------------------------------------------------------------------+



if(signal == 1 && aufgegebeneOrders < MaxOrdersProTag && OrdersTotal() == 0){
ticket = OrderSend(Symbol(),OP_BUY,Lots,Ask,30,Ask - Stopp,Ask + Kursziel,"Trend Longorder",MagicNumber,0,Green);
if(ticket>0)aufgegebeneOrders++;
}

etc.


Kann mir jemand weiterhelfen? Bin noch ziemlich unerfahren, aber lernwillig.