Ich habe noch eine Frage bzgl des Auslesens von Symbolen/Werte aus Indicatoren mittels iCustom(). Ich möchte z.b aus dem folgenden aungehängten Indikator nur den Pfeil auslesen, d.h sobald ein Pfeil nach oben auftauchte soll ein buy signal gesendet werden und umgekehrt. Es geht mir nun drum wie ich diese Information auslese.
Wird der Wert über den SetIndexBuffer() ausgelesen ? Wenn ja welchen Wert nimmt doubleA,B an, also welchen Wert gibt die FUnktion iCustom() aus ?
double A = iCustom(NULL,0,"Indicator1",1,1);
double B = iCustom(NULL,0,"Indicator1",0,1);
RefreshRates(); // RefreshRate() update Bid and Ask value.
if ( ( Ask - Bid ) / Point < MaxSpread ) { // Checking, if spread is less than MaxSpread from inputs. If its Bigger, orders wont open
// Replace 1 == 0 to your conditions to buy order.
if ( A ==1 && LastOrder != 1 ) { // LastOrder!= 1 prevent script from making a lot of same buy orders
Ticket = OrderSend ( Symbol(), OP_BUY, Lots, Ask, Slippage, Ask - ( StopLoss * Point ), Ask + ( TakeProfit * Point ), NULL, Magic, 0, Green);
LastOrder = 1; // It prevent script from making a lot of same buy orders
}
// Replace 1 == 0 to your conditions to buystop order.
if ( 1 == 0 && LastOrder != 1 ) { // LastOrder!= 1 prevent script from making a lot of same buystop orders
Ticket = OrderSend ( Symbol(), OP_BUYSTOP, Lots, Ask + ( Pips * Point ), Slippage, Ask + ( Pips * Point ) - ( StopLoss * Point ), Ask - ( Pips * Point ) + ( TakeProfit * Point ), NULL, Magic, TimeCurrent() + ( 60 * Mins ), Green);
LastOrder = 1; // It prevent script from making a lot of same buy orders
}
// Replace 1 == 0 to your conditions to sell order.
if ( B == 0 && LastOrder != 0 ) { // LastOrder!= 0 prevent script from making a lot of same sell orders
Ticket = OrderSend ( Symbol(), OP_SELL, Lots, Bid, Slippage, Bid + ( StopLoss * Point ), Bid - ( TakeProfit * Point ), NULL, Magic, 0, Red);
LastOrder = 0; // It prevent script from making a lot of same sell orders
Gruss
akuh
|