|
Startseite | Registrieren | Hilfe | Benutzerliste | Kalender | Suchen | Heutige Beiträge | Alle Foren als gelesen markieren |
Programmierung MQL4 Hier gehts rund ums Programmieren in MQL4. |
|
Themen-Optionen | Thema durchsuchen | Ansicht |
|
|||
Von Actfx auf Metatrader umprogrammieren
Servus!
Ich habe zur Zeit ein Demo Konto bei Gci. Seit ca. 2 Monaten befasse ich mich mit Auto-trading. Ist echt Interessant!!! Mein Problem, ich lasse zur zeit über Actfx eine Strategie im Probelauf Rennen. Möchte das Script aber auf Metatrader haben. Wer kann das umprogrammieren??? Ich bin ein Trottel auf dem Gebiet...... Also meine Erfahrung bisher, im Backtest kannst das vergessen, aber wenn das Ding läuft dann wirft es ein paar Euros ab;-) Hier der Code: const StrategyName = 'Open a Position Dual'; var //declaration of the variables History: TCandleHistory; Account: TAccount; Amount, Point: Double; Stop, Limit, TraderRange: Integer; procedure OnCreate; begin AddCandleHistorySetting(@History, 'Candle History', 'EUR/USD', CI_30_Minutes, 100); //setting up the chart history History.OnNewCandleEvent := @OnNewCandle; //indicating the procedure to run when a new candle opens AddAccountSetting(@Account, 'Account', ''); //the account number AddFloatSetting(@Amount, 'Amount(Lots)', 1); //the number of lots AddIntegerSetting(@Stop, 'Stop', 300); //setting up stop in pips AddIntegerSetting(@Limit, 'Limit', 43); //setting up limit in pips AddIntegerSetting(@TraderRange, 'Trader Range', 0); //setting up the trader range in pips end; // this procedure runs when a new candle opens procedure OnNewCandle; begin Point := History.Instrument.PointSize; // if the Close price of the last finished candle is higher than the Open price if History.Last(1).Open < History.Last(1).Close then // open a Buy position CreateOrder(History.Instrument, Account, Amount, bsBuy, History.Instrument.Sell - Point*Stop, History.Instrument.Sell + Point*Limit, TraderRange, 'NewPosition Buy'); // if the Close price of the last finished candle is lower than the Open price if History.Last(1).Open > History.Last(1).Close then // open a Sell position CreateOrder(History.Instrument, Account, Amount, bsSell, History.Instrument.Buy + Point*Stop, History.Instrument.Buy - Point*Limit, TraderRange, 'NewPosition Sell'); end; // this procedure runs when some changes occur in the Open Positions list procedure OnTradeChange(const Action: TDataModificationType; const Trade: TTrade); begin // if the position is opened, output the information into the log if (Action=dmtInsert) and (Trade.Tag='NewPosition') then begin log ('Sell position opened'); log ('Open Rate: ' +FloatToStr(Trade.OpenRate)); if Trade.StopOrder<>nil then log ('Stop Rate: ' +FloatToStr(Trade.StopOrder.Rate)); if Trade.LimitOrder<>nil then log ('Limit Rate: ' +FloatToStr(Trade.LimitOrder.Rate)); end; end; Geändert von Master (18.10.11 um 19:18 Uhr) |
Lesezeichen |
Stichworte |
actfx, actfx.com, ea umprogrammieren, ea ändern, expert advisor umprogrammieren, expert advisor ändern, metatrader programmierung, mql4 |
Themen-Optionen | Thema durchsuchen |
Ansicht | |
|
|