Der holy grail ist das sicher nicht.
ich kopiere mal ein bisserl code, das lässt sich in einem Ea nutzen:
variablen:
Code:
//
extern bool TradeOnSuperTrendUpDnSignals = true;
extern bool TradeIfSuperTrendDirectionIsOk = true;
//
extern int SuperTrendAtrPeriod = 13;
extern double SuperTrendAtrMultiplier = 3.5;
string iCustomSuperTrendName = "NonRepaintingSuperTrend";
functions:
Code:
int GetIndicatorValues() {
int type=99;
if (TradeIfSuperTrendDirectionIsOk) {
if (SuperTrendNRPOk(OP_BUY)) return(OP_BUY);
if (SuperTrendNRPOk(OP_SELL)) return(OP_SELL);
}
if (TradeOnSuperTrendUpDnSignals) {
if (SuperTrendNRPSignalOk(OP_BUY)) return(OP_BUY);
if (SuperTrendNRPSignalOk(OP_SELL)) return(OP_SELL);
}
return(type);
}
bool SuperTrendNRPOk(int type) {
double tup = iCustom(Symbol(),0,iCustomSuperTrendName,SuperTrendAtrPeriod,SuperTrendAtrMultiplier,0,SignalCandle);
double tdn = iCustom(Symbol(),0,iCustomSuperTrendName,SuperTrendAtrPeriod,SuperTrendAtrMultiplier,1,SignalCandle);
if (type==OP_BUY && tup!=EMPTY_VALUE && tdn==EMPTY_VALUE) return(true);
if (type==OP_SELL && tup==EMPTY_VALUE && tdn!=EMPTY_VALUE) return(true);
return(false);
}
bool SuperTrendNRPSignalOk(int type) {
double tup = iCustom(Symbol(),0,iCustomSuperTrendName,SuperTrendAtrPeriod,SuperTrendAtrMultiplier,2,SignalCandle);
double tdn = iCustom(Symbol(),0,iCustomSuperTrendName,SuperTrendAtrPeriod,SuperTrendAtrMultiplier,3,SignalCandle);
if (type==OP_BUY && tup!=EMPTY_VALUE && tdn==EMPTY_VALUE) return(true);
if (type==OP_SELL && tup==EMPTY_VALUE && tdn!=EMPTY_VALUE) return(true);
return(false);
}