• Home
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • User/Email: Password:
  • 1:55am
Menu
  • Forums
  • Trades
  • News
  • Calendar
  • Market
  • Brokers
  • Login
  • Join
  • 1:55am
Sister Sites
  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Options

Bookmark Thread

First Page First Unread Last Page Last Post

Printable Version

Similar Threads

IBFX New Policy 5 replies

IBFX Problem / New Broker Question 6 replies

Stoopid Newbie Questions about IBFx New 5 Decimal Place Feed 6 replies

What's wrong with this IBFX script code? 6 replies

IBFX changed their demo policy, where can I get an unlimited demo? 9 replies

  • Platform Tech
  • /
  • Reply to Thread
  • Subscribe
  • 2
Attachments: EA needs code adjusted to IBFX new policy
Exit Attachments

EA needs code adjusted to IBFX new policy

  • Post #1
  • Quote
  • First Post: Jul 22, 2010 6:54pm Jul 22, 2010 6:54pm
  •  todd960960
  • | Joined Nov 2008 | Status: Member | 470 Posts
Would someone mind adjusting the code in this EA so that it would be compatible with IBFX's new bs policy.

I need a delay between the time the EA opens a trade and it placing the T/P and S/L orders. 30 second or so would be just fine for me.

Thx,
todd
Attached File
File Type: mq4 universalMACrossEAV1.1.mq4   33 KB | 204 downloads
  • Post #2
  • Quote
  • Jul 26, 2010 12:38pm Jul 26, 2010 12:38pm
  •  Mistigri
  • | Joined Aug 2006 | Status: Member | 11 Posts
This should be working now.
Attached File
File Type: mq4 universalMACrossEAV1.1.mq4   33 KB | 260 downloads
  • Post #3
  • Quote
  • Jul 26, 2010 8:40pm Jul 26, 2010 8:40pm
  •  todd960960
  • | Joined Nov 2008 | Status: Member | 470 Posts
Quoting Mistigri
Disliked
This should be working now.
Ignored
Thankyou very much! I'll give it a test.

todd
  • Post #4
  • Quote
  • Jul 27, 2010 2:59am Jul 27, 2010 2:59am
  •  ecTrade
  • | Joined Jul 2009 | Status: Member | 1,163 Posts
A delay? So, it doesn't place T/P's ad S/L's immediately. I too have an IBFX (mini) account and, although I've noticed they've gone to 5 digits now, I haven't noticed anything else out of the ordinary ... at least when backtesting anyway.

Guess I will find out as soon as I go live.
  • Post #5
  • Quote
  • Jul 27, 2010 10:56am Jul 27, 2010 10:56am
  •  Mistigri
  • | Joined Aug 2006 | Status: Member | 11 Posts
IBFX switched from Instant Orders to Market Orders ... Because of that you can no longer place an order with a TP and SL. Instead you have to send your order with NO stop loss or profit target and then ( once the order is live ) update it ( with your stop loss and profit target ).

You don't need to add a delay really and you should be able to update an order's stop loss and take profit within milliseconds after the order was placed.
  • Post #6
  • Quote
  • Jul 27, 2010 6:38pm Jul 27, 2010 6:38pm
  •  ecTrade
  • | Joined Jul 2009 | Status: Member | 1,163 Posts
What's that, using OrderModify()?

Okay, I'm looking at the code of the EA you modified and it appears this is what you did.

Thanks.
  • Post #7
  • Quote
  • Jul 27, 2010 7:18pm Jul 27, 2010 7:18pm
  •  ecTrade
  • | Joined Jul 2009 | Status: Member | 1,163 Posts
Or, what if they are pending orders? Is it still okay to specify TP and SL values when placing pending orders? Maybe this is why my EA still works while backtesting, because these are most of the orders I am placing?
  • Post #8
  • Quote
  • Jul 27, 2010 8:10pm Jul 27, 2010 8:10pm
  •  kennyhubbard
  • Joined Sep 2008 | Status: Member | 293 Posts
I stand corrected, but I think for a limit order you can enter a SL or TP but a stop order still needs a SL/TP entered after the fill.

Either will still work in the tester as it cannot differentiate a market execution broker from an instant execution broker.
  • Post #9
  • Quote
  • Jul 27, 2010 8:36pm Jul 27, 2010 8:36pm
  •  ecTrade
  • | Joined Jul 2009 | Status: Member | 1,163 Posts
The whole thing seems kind of silly if you ask me. But, if you gotta do it you gotta do it ...

So, does this code look alright?

PHP Code:
      if(hedge && Bid>=S_LOOP+s_rge && B==0)
      {
         
OOP=Ask;
         
T_00[0]=OrderSend(S1,0,lot_b[0],OOP,3,0,0,"B",magic,0,clr_0);
         
OrderModify(T_00[0],OOP,0,OOP+tp1,0,clr_0);
      } 
Am placing OrderModify() immediately after OrderSend(). It should still work correctly shouldn't it? It appears to work correctly when backtesting anyway.
  • Post #10
  • Quote
  • Jul 27, 2010 8:51pm Jul 27, 2010 8:51pm
  •  ecTrade
  • | Joined Jul 2009 | Status: Member | 1,163 Posts
I'm wondering if it might be better to place the OrderModify() outside of OrderSend() parameters. So if, for whatever reason the order doesn't get modified right away (if this is possible?), there are any number of opportunities to modify the order afterwards, as opposed to a one-shot deal. It could save myself quite a few headaches if it ever gets messed up.

Oh, the code in the example is for a market order, although most of the other examples I have are for buystops and sellstops. Have basically incorporated the same idea though.
  • Post #11
  • Quote
  • Jul 28, 2010 1:27am Jul 28, 2010 1:27am
  •  kennyhubbard
  • Joined Sep 2008 | Status: Member | 293 Posts
Quote
Disliked
The whole thing seems kind of silly if you ask me. But, if you gotta do it you gotta do it ...

Hi ecTrade,

I know it does appear strange at first, but if you read in the broker section on the MB Trading thread, one chap got slipped 100 pips on his market order, it becomes apparent why it is not practical to enter a stop before you know what fill you picked up on the order. Stop orders are bad things......unfortunately its that or the bucketshop....sort of 'How would you like to be executed, with a blindfold or without'

Anyway, your code looks good except for 1 remark, if you are interested......the interleaving of "if" conditions is a huge drag on execution speed. I usually break it into single if statements starting with the ones least likey to be executed. In this particular case its not a problem but many times your condition will include a function as an argument and this will be carried out each and every tic, even if the other conditions do not require the statment to be executed.

You also make a good point about backing up your ordermodify elsewhere in the program. I guess it depends on your strategy. If you have a trade management program, I guess this is less serious. In your case I see there is no SL and only a TP. I would think a good trailing stop program would mean that a backup Ordermodify is not an issue.
  • Post #12
  • Quote
  • Jul 28, 2010 2:34am Jul 28, 2010 2:34am
  •  ecTrade
  • | Joined Jul 2009 | Status: Member | 1,163 Posts
Quoting kennyhubbard
Disliked
Hi ecTrade,

I know it does appear strange at first, but if you read in the broker section on the MB Trading thread, one chap got slipped 100 pips on his market order, it becomes apparent why it is not practical to enter a stop before you know what fill you picked up on the order.
Ignored
What about setting the slippage though? Isn't that supposed to insure that it doesn't go beyond a certain amount of pips? Or, are you saying brokers don't necessarily have to abide by this? If not, then that's news to me ... but, then again what do I know?

Quote
Disliked
Stop orders are bad things......unfortunately its that or the bucketshop....sort of 'How would you like to be executed, with a blindfold or without'
Are you talking about pending orders? Actually, I have found a very good use for them.

Quote
Disliked
Anyway, your code looks good except for 1 remark, if you are interested......the interleaving of "if" conditions is a huge drag on execution speed. I usually break it into single if statements starting with the ones least likey to be executed. In this particular case its not a problem but many times your condition will include a function as an argument and this will be carried out each and every tic, even if the other conditions do not require the statment to be executed.
Well, whatever it takes to improve performance. Will bear this in mind. Thanks.

Quote
Disliked
You also make a good point about backing up your ordermodify elsewhere in the program. I guess it depends on your strategy. If you have a trade management program, I guess this is less serious. In your case I see there is no SL and only a TP. I would think a good trailing stop program would mean that a backup Ordermodify is not an issue.
Well, I'm thinking about by-passing the initial attempt altogether and setting it up to do this at a later stage, although it will require more code. Also, if the TP doesn't get set then the order won't close-out when it should (in profit) and won't trigger the next order which is supposed to open after this. At which point the EA loses part of its functionality.
  • Post #13
  • Quote
  • Jul 28, 2010 2:49am Jul 28, 2010 2:49am
  •  kennyhubbard
  • Joined Sep 2008 | Status: Member | 293 Posts
Howdy,

Slippage is a parameter that is used by instant execution brokers to determine whether they may slip you or re-quote you.

In an ECN environment, the slippage parameter is ignored totally, in fact, you will never ever see a requote at a market execution broker. It was simply not practical for metaquotes to remove it from the syntax without causing huge compatibility problems.

As a matter of interest, at an ECN, the price is ignored as well. Do a test sometime and run this command in a script :-

Inserted Code
OrderSend(Symbol(),OP_BUY,1,0,0,0,0,"ECN Test",0,0,CLR_NONE);

The broker returns the best price possible, and therefore, there is no point in telling them what price you desire. Its not unlike selling your car at an unreserved auction, you take what you get. Obviously good coding dictates that you put the price in simply for the benefits of anyone that wants to use the same EA at a instant execution broker.

In terms of pending orders, limit orders are great....the broker always fills you at that price or better, but a stop order is more like a delayed market order....as soon as it is triggered, it gets treated like a market order and is subject to the same issues as mentioned before. Possibly there would be a latency advantage by having the instruction sitting at the broker, resulting in slightly better fills than a pure market order.
  • Post #14
  • Quote
  • Jul 28, 2010 3:48am Jul 28, 2010 3:48am
  •  ecTrade
  • | Joined Jul 2009 | Status: Member | 1,163 Posts
So it's bye-bye instant execution with IBFX then? Have always thought that to be a selling feature of a broker, so long as there weren't a lot re-quotes, that is.

Or, is it just not practical for brokers to do this?
  • Post #15
  • Quote
  • Jul 28, 2010 4:23am Jul 28, 2010 4:23am
  •  kennyhubbard
  • Joined Sep 2008 | Status: Member | 293 Posts
I am not sure.............a price feed is a product that the brokers "purchase". I suspect that when the broker buys a licence for MT4 server, they have 2 price feeds. Normally they use one for demo and one for live. I also assume they can purchase extra price feeds but this comes at a cost.

I think whether they offer both types would depend on their size and customer demand. Traditionally the market maker models has been the most profitable and most stable but there has been a marked move towards STP/ECN offering over the last 18 months, so brokers not offering it are losing ground.

I believe IBFX is big enough that they may justify having both models.

BTW, there is some good reading on the Boston Technologies website about these things. They offer a packaged SYOB(start your own broker) setup........
  • Post #16
  • Quote
  • Jul 28, 2010 5:45am Jul 28, 2010 5:45am
  •  Dredding82
  • | Commercial Member | Joined Jun 2010 | 2,022 Posts
I am not new to trading but am new to coding anything....i have an EA i built off a webpage and i was wondering if theres any way for the EA to look at more then one TF at a time? I have tried to have it say "PERIOD_M15" and "PERIOD_M30" but after i attach the EA it still only looks at the M15 not both.....if someone would please give me alil insight i would be very greatful
  • Post #17
  • Quote
  • Jul 28, 2010 10:08am Jul 28, 2010 10:08am
  •  ecTrade
  • | Joined Jul 2009 | Status: Member | 1,163 Posts
Maybe you could try opening up two separate charts with separate time frames?
  • Post #18
  • Quote
  • Last Post: Jul 28, 2010 11:25am Jul 28, 2010 11:25am
  •  Dredding82
  • | Commercial Member | Joined Jun 2010 | 2,022 Posts
Yea im tryin that now....seems to work as far as i could see, i have M1-M15 up with the EA attached and it only gave order to buy/sell/close so far when all where good...Im also tryin to do a trailing sl...but not by points more like a fractal...like in a buy my sl would be the last lowest low and when a new highest low forms i would move my SL there to lock in profit......If anyone could help i would be very very greatful
  • Platform Tech
  • /
  • EA needs code adjusted to IBFX new policy
  • Reply to Thread
0 traders viewing now
Top of Page
  • Facebook
  • Twitter
About FF
  • Mission
  • Products
  • User Guide
  • Media Kit
  • Blog
  • Contact
FF Products
  • Forums
  • Trades
  • Calendar
  • News
  • Market
  • Brokers
  • Trade Explorer
FF Website
  • Homepage
  • Search
  • Members
  • Report a Bug
Follow FF
  • Facebook
  • Twitter

FF Sister Sites:

  • Metals Mine
  • Energy EXCH
  • Crypto Craft

Forex Factory® is a brand of Fair Economy, Inc.

Terms of Service / ©2021