Hi all,

I attempt to code an EA that deal with d'alembert progression (for all that don´t know progression d'alembert: http://www.bettingexpert.com/casino/...lembert-system )

The plan is to start with 0.01 lots and SL 13 pips / TP 14 pips.

Every time a trade near with a reduction, a new commerce open instantly with additional 0.01 lots and after a triumph trade next trade open instantly with 0.01 lots less than the lotsize before we arrive at 0.01 lots.


Instance:

1. trade 0.01 lots loss

2. Trade 0.02 lots loss

3. trade 0.03 lots loss

4. trade 0.04 lots loss

5. Trade 0.05 lots win

6. Trade 0.04 lots win

7. Trade 0.03 lots win

8. Trade 0.02 lots win

9. Trade 0.01 lots win


So here is my first code attempt but it doesn´t operate from the startegy tester. :--LRB-

who can assist?


Inserted Code // ------------------------------------------------------------------ //| A4.mq4 | //| Copyright © 2010, MetaQuotes Software Corp.. | //| http://www.metaquotes.net | // ------------------------------------------------------------------ #property copyright Copyright © 2010, MetaQuotes Software Corp. #property Hyperlink http://www.metaquotes.net // ------------------------------------------------------------------ //| extern input parameters | // ------------------------------------------------------------------ extern int MagicNumber_101=101000; extern int SL=13; extern int TP=14; double dXPoint=1; // ------------------------------------------------------------------ //| expert initialization serve | // ------------------------------------------------------------------ int init() //-- //-- return(0); // ------------------------------------------------------------------ //| expert deinitialization function | // ------------------------------------------------------------------ int deinit() //-- //-- return(0); // ------------------------------------------------------------------ //| expert start function | // ------------------------------------------------------------------ int start() double Lotsize = 0.01; if (OrdersHistoryTotal()gt;=1) OrderSelect(OrdersHistoryTotal()-1,SELECT_BY_POS); Lotsize = OrderLots(); if (OrderProfit()lt;0 OrdersHistoryTotal()gt;=1) Lotsize = Lotsize 0.01; if (OrderProfit()gt;0 OrdersHistoryTotal()gt;=1 Lotsizegt;=0.02) Lotsize = Lotsize - 0.01; if (OrdersHistoryTotal()lt;1 Minute()==00) OrderSend(Symbol(),OP_BUY,0.01,MarketInfo(Symbol() ,MODE_ASK),2,Bid-SL*Point,Bid TP*Point,buy,MagicNumber_101,0,CLR_NONE); Sleep(120000); if (OrdersTotal()==0 Minute()==00) OrderSelect(OrdersHistoryTotal()-1,SELECT_BY_POS); if (OrderProfit()gt;0 OrderType()==OP_BUY) OrderSend(Symbol(),OP_BUY,0.01,MarketInfo(Symbol() ,MODE_ASK),2,Bid-SL*Point,Bid TP*Point,buy,MagicNumber_101,0,CLR_NONE); Sleep(120000); if (OrdersTotal()==0 Minute()==00) if (OrderProfit()gt;0 OrderType()==OP_SELL) OrderSend(Symbol(),OP_SELL,0.01,MarketInfo(Symbol( ),MODE_BID),2,Ask SL*Point,Ask-TP*Point,market,MagicNumber_101,0,CLR_NONE); Sleep(120000); if (OrdersTotal()==0 Minute()==00) if (OrderProfit()lt;0 OrderType()==OP_SELL) OrderSend(Symbol(),OP_BUY,0.01,MarketInfo(Symbol() ,MODE_ASK),2,Bid-SL*Point,Bid TP*Point,buy,MagicNumber_101,0,CLR_NONE); Sleep(120000); if (OrdersTotal()==0 Minute()==00) if (OrderProfit()lt;0 OrderType()==OP_BUY) OrderSend(Symbol(),OP_SELL,0.01,MarketInfo(Symbol( ),MODE_BID),2,Ask SL*Point,Ask-TP*Point,market,MagicNumber_101,0,CLR_NONE); Sleep(120000); return(0);
Please no comments just like Blow your account away. . .blabla
Just sharing a trading egy.

Regards.