
vor 4 Wochen
|
Elite Mitglied
|
|
Registriert seit: Apr 2011
Beiträge: 2.711
|
|
Das ist der letzte Teil deines Posts:
Code:
void OnTick()
{
// Get the current price
double currentPrice = Bid;
// Check if the last trade was a buy
if (LastTradeDirection == 1)
{
// Check if the price has crossed below the moving average
if (currentPrice < MovingAverageBuffer[LastTradeBar])
{
// Place a sell order at the current price
double stopLoss = currentPrice + StopLossPips * Point;
double takeProfit = currentPrice - TakeProfitPips * Point;
OrderSend(Symbol(), OP_SELL, LotSize, currentPrice, 0, stopLoss,takeProfit, "Sell order", 0, 0, Red);
LastTradeDirection = -1;
LastTradePrice = currentPrice;
LastTradeBar = Bars - 1;
}
}
// Check if the last trade was a sell
else if (LastTradeDirection == -1)
{
// Check if the price has crossed above the moving average
if (currentPrice > MovingAverageBuffer[LastTradeBar])
{
// Place a buy order at the current price
double stopLoss = currentPrice
Mal davon abgesehen, dass hinter ler letzten Zeile ein ; kommt, fehlen hie 3 } Klammern!!
Ich habe die öffnenden { Klammern mal rot gekennzeichnet, zu denen es keine schließende } Klammer gibt.
Oder fehlt in Deinem Post ein Stück Code?
Desweiteren solltest du in Zukunft den Code mittels des Buttons # oben im Menü schreiben und dann dir auch gleich angewöhnen, die Zeilen wie bei mir entsprechend einzurücken. Das bewahrt die Übersicht.
traderdoc
__________________
Ich erfülle Euch gern Eure EA-, Indikator- und Script-Programmierungswünsche auf Honorarbasis.
|