Martingale with "low" margin hit

Place your new trading idea here to see if someone can automate it.
Post Reply
DragosDanescu
Trader
Posts: 118
Joined: Wed Nov 16, 2011 5:18 pm
Location: Oradea, Western Romania

Re: Martingale with "low" margin hit

Post by DragosDanescu »

Well, I had simplified them as much as possible. Can also input an option to reduce the expected profit if lots are bigger than baselot but lower than maxlot.

Have fun
Image
User avatar
spyderman
Trader
Posts: 338
Joined: Sun Dec 11, 2011 1:39 pm

Re: Martingale with "low" margin hit

Post by spyderman »

DD,

Here is the EA place on E/U. There's a whole lot of inputs in there I'm assuming I don't use. Does this look right based on the info panel.

Do I need to place a trade manually and then place the ea on it or how do I initiate it?

Sorry if these seem like dumb questions. :roll:
You do not have the required permissions to view the files attached to this post.
Snaggin' some pips
DragosDanescu
Trader
Posts: 118
Joined: Wed Nov 16, 2011 5:18 pm
Location: Oradea, Western Romania

Re: Martingale with "low" margin hit

Post by DragosDanescu »

Hmm, strange, it should already read the bar status. Which broker is that? HotForex, dumb me...Please throw it on a H1 chart.

If you use Inside/Outside bars as trigger, as you did, it waits for that, then it places orders.
Also, 1.33 multiplier is not good, as it rounds up to same 0.01.

Try this one...it should display "Using InsideBar: status: none", if it founds no trigger yet.You can try it also on M15 chart, it needs a bar completed to read the status properly.
Last edited by DragosDanescu on Tue Jan 03, 2012 5:39 pm, edited 1 time in total.
Image
User avatar
spyderman
Trader
Posts: 338
Joined: Sun Dec 11, 2011 1:39 pm

Re: Martingale with "low" margin hit

Post by spyderman »

DragosDanescu wrote: Also, 1.33 multiplier is not good, as it rounds up to same 0.01.
So it just rounds to the nearest...you can't set it to always round up. That'll create a problem as we need the 1.3333 to keep the progression lower at the top end.

I've set it on the H1 so we'll watch it.
Snaggin' some pips
DragosDanescu
Trader
Posts: 118
Joined: Wed Nov 16, 2011 5:18 pm
Location: Oradea, Western Romania

Re: Martingale with "low" margin hit

Post by DragosDanescu »

Well, it's displaying correct status now, just found a problem in OrdersHistory readings. You should try this one. But, for a faster test, I suggest you run it in the backtester aswell, just to check correct logic.

P.S. Have no ideea atm how to round them up...to the nearest superior value.
You do not have the required permissions to view the files attached to this post.
Image
sini
Trader
Posts: 19
Joined: Tue Jan 03, 2012 11:24 am

Re: Martingale with "low" margin hit

Post by sini »

DragosDanescu wrote:Well, it's displaying correct status now, just found a problem in OrdersHistory readings. You should try this one. But, for a faster test, I suggest you run it in the backtester aswell, just to check correct logic.

P.S. Have no ideea atm how to round them up...to the nearest superior value.

Hi,

I can not make Backtest, only two trades and i recive this erors:

2012.01.03 19:29:51 2011.01.04 08:16 Tester: stop loss #2 at 1.55044 (1.55025 / 1.55045)
2012.01.03 19:29:51 2011.01.04 06:16 FinalBreakout_lim_stop GBPUSD,H4: delete #3 buy stop 0.01 GBPUSD at 1.55044 sl: 1.54634 tp: 0.00000 ok
2012.01.03 19:29:51 2011.01.04 06:16 FinalBreakout_lim_stop GBPUSD,H4: open #3 buy stop 0.01 GBPUSD at 1.55044 sl: 1.54634 ok
2012.01.03 19:29:51 2011.01.04 06:16 FinalBreakout_lim_stop GBPUSD,H4: delete #1 buy stop 0.01 GBPUSD at 1.55044 sl: 1.54634 tp: 0.00000 ok
2012.01.03 19:29:51 2011.01.04 06:16 Tester: order #2, sell 0.01 GBPUSD is opened at 1.54634
2012.01.03 19:29:50 2011.01.03 20:00 FinalBreakout_lim_stop GBPUSD,H4: open #2 sell stop 0.01 GBPUSD at 1.54634 sl: 1.55044 ok
2012.01.03 19:29:50 2011.01.03 20:00 FinalBreakout_lim_stop GBPUSD,H4: open #1 buy stop 0.01 GBPUSD at 1.55044 sl: 1.54634 ok
2012.01.03 19:29:50 FinalBreakout_lim_stop inputs: Lot=0.01; ProfitLevel=6; MagicNumber=235; MaxSpread=40; LevelsOffset=15; MartingaleMultiplier=1.5; MaximumLots=0.03; NetProfit=100; MaxRetrace=5; DisplayGapSize=30;
2012.01.03 19:29:47 TestGenerator: unmatched data error (high value 1.5618 at 2011.11.29 20:00 is not reached from the least timeframe, high price 1.5615 mismatches)
2012.01.03 19:29:44 TestGenerator: unmatched data error (high value 1.5612 at 2011.10.10 00:00 is not reached from the least timeframe, high price 1.5547 mismatches)
2012.01.03 19:29:44 TestGenerator: unmatched data error (low value 1.5544 at 2011.10.10 00:41 and price 1.5542 mismatched)
2012.01.03 19:29:44 TestGenerator: unmatched data error (low value 1.5544 at 2011.10.10 00:40 and price 1.5543 mismatched)
2012.01.03 19:29:44 TestGenerator: unmatched data error (low value 1.5544 at 2011.10.10 00:39 and price 1.5543 mismatched)
2012.01.03 19:29:44 TestGenerator: unmatched data error (low value 1.5544 at 2011.10.10 00:38 and price 1.5543 mismatched)
User avatar
spyderman
Trader
Posts: 338
Joined: Sun Dec 11, 2011 1:39 pm

Re: Martingale with "low" margin hit

Post by spyderman »

DragosDanescu wrote:Well, it's displaying correct status now, just found a problem in OrdersHistory readings. You should try this one. But, for a faster test, I suggest you run it in the backtester aswell, just to check correct logic.

P.S. Have no ideea atm how to round them up...to the nearest superior value.
I have it on 6 pairs on 1H. No trades yet.
Snaggin' some pips
User avatar
gaheitman
Trader
Posts: 655
Joined: Tue Nov 15, 2011 10:55 pm
Location: Richmond, VA, US

Re: Martingale with "low" margin hit

Post by gaheitman »

DragosDanescu wrote:Well, it's displaying correct status now, just found a problem in OrdersHistory readings. You should try this one. But, for a faster test, I suggest you run it in the backtester aswell, just to check correct logic.

P.S. Have no ideea atm how to round them up...to the nearest superior value.
Not sure if this helps, but how about just making sure that the lotsize increases by at least LOTSTEP each time. For example, the following code:

Code: Select all

double multiplier = 1.3333;
double lotsize = 0.01;
double newlotsize = 0;

   for (int x=1;x<20;x++) {
      //the multiple lines below are mostly so it looks nice in the forum

      //calculate the lot size
      newlotsize = multiplier*lotsize;

      //make sure it is at least LOTSTEP bigger than the last lot size
      newlotsize = MathMax(newlotsize,lotsize+MarketInfo(Symbol(),MODE_LOTSTEP));

      //and round it
      newlotsize = NormalizeDouble(newlotsize,2);
      Print(lotsize, " => ",newlotsize);
      lotsize = newlotsize;

   }
Prints this sequence:

Code: Select all

16:26:04 Util EURUSD,M1: 0.01 => 0.02
16:26:04 Util EURUSD,M1: 0.02 => 0.03
16:26:04 Util EURUSD,M1: 0.03 => 0.04
16:26:04 Util EURUSD,M1: 0.04 => 0.05
16:26:04 Util EURUSD,M1: 0.05 => 0.07
16:26:04 Util EURUSD,M1: 0.07 => 0.09
16:26:04 Util EURUSD,M1: 0.09 => 0.12
16:26:04 Util EURUSD,M1: 0.12 => 0.16
16:26:04 Util EURUSD,M1: 0.16 => 0.21
16:26:04 Util EURUSD,M1: 0.21 => 0.28
16:26:04 Util EURUSD,M1: 0.28 => 0.37
16:26:04 Util EURUSD,M1: 0.37 => 0.49
16:26:04 Util EURUSD,M1: 0.49 => 0.65
16:26:04 Util EURUSD,M1: 0.65 => 0.87
16:26:04 Util EURUSD,M1: 0.87 => 1.16
16:26:04 Util EURUSD,M1: 1.16 => 1.55
16:26:04 Util EURUSD,M1: 1.55 => 2.07
16:26:04 Util EURUSD,M1: 2.07 => 2.76
16:26:04 Util EURUSD,M1: 2.76 => 3.68
Using a multiplier of 1.5 gives this sequence:

Code: Select all

16:29:25 Util EURUSD,M1: 0.01 => 0.02
16:29:25 Util EURUSD,M1: 0.02 => 0.03
16:29:25 Util EURUSD,M1: 0.03 => 0.05
16:29:25 Util EURUSD,M1: 0.05 => 0.08
16:29:25 Util EURUSD,M1: 0.08 => 0.12
16:29:25 Util EURUSD,M1: 0.12 => 0.18
16:29:25 Util EURUSD,M1: 0.18 => 0.27
16:29:25 Util EURUSD,M1: 0.27 => 0.41
16:29:25 Util EURUSD,M1: 0.41 => 0.62
16:29:25 Util EURUSD,M1: 0.62 => 0.93
16:29:25 Util EURUSD,M1: 0.93 => 1.4
16:29:25 Util EURUSD,M1: 1.4 => 2.1
16:29:25 Util EURUSD,M1: 2.1 => 3.15
16:29:25 Util EURUSD,M1: 3.15 => 4.73
16:29:25 Util EURUSD,M1: 4.73 => 7.1
16:29:25 Util EURUSD,M1: 7.1 => 10.65
16:29:25 Util EURUSD,M1: 10.65 => 15.98
16:29:25 Util EURUSD,M1: 15.98 => 23.97
16:29:25 Util EURUSD,M1: 23.97 => 35.96
George
DragosDanescu
Trader
Posts: 118
Joined: Wed Nov 16, 2011 5:18 pm
Location: Oradea, Western Romania

Re: Martingale with "low" margin hit

Post by DragosDanescu »

That means it's working. Use 1.5 multiplier, anyway, until I sort out that 1.3333 that you want.
Or...better use this one, but only with 0.01 as base lot!
Image
DragosDanescu
Trader
Posts: 118
Joined: Wed Nov 16, 2011 5:18 pm
Location: Oradea, Western Romania

Re: Martingale with "low" margin hit

Post by DragosDanescu »

Wow, thanks, George, useful as always! Was scrambling my brain to get something like that, but I never used Math functions before, thank you again!

Dragos
You do not have the required permissions to view the files attached to this post.
Last edited by DragosDanescu on Tue Jan 03, 2012 10:08 pm, edited 1 time in total.
Image
Post Reply

Return to “Ideas for Possible Automation”