LibOrderReliable4

User avatar
slipshod
Trader
Posts: 404
Joined: Tue Dec 27, 2011 9:14 am
Location: Australia

Re: LibOrderReliable4

Post by slipshod »

I've worked with jlcgarcia (many thanks!) stress-testing and ironing out bugs from my changes, and I thought I should post the revised library here. Changes are listed in the comments at the top of the library's sourcecode.

Hopefully its just an interim release & Matt will return and bestow on us a LibOrderReliable5, but in the meantime if anyone notices any buggy behaviour please let me know.
You do not have the required permissions to view the files attached to this post.
intcust
Trader
Posts: 285
Joined: Wed Oct 03, 2012 9:12 pm

Re: LibOrderReliable4

Post by intcust »

I am trying to do a oco with a close and reverse function on the trade that takes. Any ideas? I looked at Steve code but I don't know any coding and I cannot even figure out how to set up the price I want to enter the trades at. Any help appreciated. I want to learn to fish.
User avatar
slipshod
Trader
Posts: 404
Joined: Tue Dec 27, 2011 9:14 am
Location: Australia

Re: LibOrderReliable4

Post by slipshod »

intcust, if you don't know the price at which you should be entering, there's no point looking at OCOs and steve's code. I'd suggest visiting nanningbob's thread on this forum & others in the manual trading section in order to learn a profitable trading strategy first. Then when & if you want to automate something you can look at code etc, but that's down the track not something you'd start off with.
intcust
Trader
Posts: 285
Joined: Wed Oct 03, 2012 9:12 pm

Re: LibOrderReliable4

Post by intcust »

Slipshod,

I obviously did a bad job on my post. I already have the system that I am trading manually. What I want an EA to do seems simple to me compared to what I see you guys do but I cannot get one to do anything. What I am trying to do is place a straddle trade at a specific prices (not on any indicator or time only price) then put on the tp and sl . If sl is hit then I want to take the trade in the opposite direction. Regardless of what side of the straddle was hit. One trouble I have is being in the US our brokers do not allow hedging there by when 2 limit orders are attempted to be placed Empty4 views it as a hedge and will not take the second trade even though if the first trade was activated the sl would kick in before the other trade hit price. So I cannot do a manual oco (one cancels other) and forget trying to do a close and reverse by limit orders same problem would occur with hedging. So what I want the ea to do is place two trades were I tell it too with the stops I select and have the close and reverse option if the trade that gets activated gets stopped out. I want to reset the enter prices everyday or several times a day. I would really like to try and learn to program that is what I meant by learning to fish. But so far my attempts get nothing but error messages and frustration.
User avatar
slipshod
Trader
Posts: 404
Joined: Tue Dec 27, 2011 9:14 am
Location: Australia

Re: LibOrderReliable4

Post by slipshod »

Ah ok I understand now! Sorry I got you all wrong on your first post.

What I'd suggest is something like this... let's say your EA knows the prices at which it'd want to OCO, for example AU was at 1.05 and you have a buy at 1.056 and a sell at 1.044. The buy gets triggered, then the market reverses and drops towards its stop at 1.044 where you'd want to OCO. Your code could look something like this (psuedo-code, this won't work as-is):-

Code: Select all

double BuyLevel, SellLevel;

void FindEntryLevels()
{
   // your logic here for setting BuyLevel and SellLevel
}

void LookForEntries()
{
   // check to see if any trades are running on this symbol/magic number etc
   // if there are, return from the function without doing anything.
   
   if (Bid <= SellLevel)
   {
      // enter a sell at market
   }
   else if (Ask >= BuyLevel)
   {
      // enter a buy at market
   }
}
Does that make sense? You don't enter if there's an entry already running, so it won't hedge. When there's nothing running & the price is at or past your entry points you enter at market.

Pretty simplistic, and obviously there's a lot of gaps you'd need to fill there. If you have any specific problems that you can't figure out, don't hesitate to create a thread on this part of the forum.
intcust
Trader
Posts: 285
Joined: Wed Oct 03, 2012 9:12 pm

Re: LibOrderReliable4

Post by intcust »

Thanks I will try to work on it this weekend. I did look at CJ naked trading thread. Pretty neat stuff going on there. To often we forgot price is always right.
User avatar
snailbeard
Trader
Posts: 615
Joined: Mon Dec 24, 2012 10:54 am
Location: Just above water somewhere between Oxford & Cambridge

Re: LibOrderReliable4

Post by snailbeard »

slipshod wrote:I've worked with jlcgarcia (many thanks!) stress-testing and ironing out bugs from my changes, and I thought I should post the revised library here. Changes are listed in the comments at the top of the library's sourcecode.

Hopefully its just an interim release & Matt will return and bestow on us a LibOrderReliable5, but in the meantime if anyone notices any buggy behaviour please let me know.
Thanks for keeping this going - I made a small change to my copy - for backtesting - I'm including the header at the top of my EA, and the source at the bottom.

To get rid of compiler errors I moved the globals into the OR header - my EA already had some inherited O_R_ stuff in it which I commented out - but then I had an error about missing Retries variable used in the EA already, so I added
int O_R_getRetries()
to the OR files - now seems to have stopped complaining
and the back test is running again :D

Thanks
Brian
Raj4x

Re: LibOrderReliable4

Post by Raj4x »

Thanks alot Slipshod, just want to let you know I truly appreciate the updates on LibOrderReliable4.

Cheers :)
User avatar
ovisun
Trader
Posts: 63
Joined: Sun Mar 18, 2012 11:54 am
Location: Romania, Constanta

Re: LibOrderReliable4

Post by ovisun »

Hi mbkennel,

LibOrderReliable is not working with last Empty4 update to build 600 . I'm using a version of xMeter by JoseLuis and now when a new trade is open in a series, the TP of the old trades is not updated. Also, the EA can not be compiled, only by going back to an old Empty4 after internet is disconnected to avoid automatic update of Empty4 is possible to compile the EA.
Maybe you can have a look and check the problem, please.

Best Regards,
ovisun.
Image
dietcoke
Trader
Posts: 162
Joined: Tue Nov 15, 2011 9:59 pm

Re: LibOrderReliable4

Post by dietcoke »

ovisun » Mon Feb 10, 2014 8:04 am wrote:Hi mbkennel,

LibOrderReliable is not working with last Empty4 update to build 600 . I'm using a version of xMeter by JoseLuis and now when a new trade is open in a series, the TP of the old trades is not updated. Also, the EA can not be compiled, only by going back to an old Empty4 after internet is disconnected to avoid automatic update of Empty4 is possible to compile the EA.
Maybe you can have a look and check the problem, please.

Best Regards,
ovisun.
I've had no problems compiling liborderreliable which suggests you do have the mqh and mq4 files in the correct locations.

the mqh should be in \mql4\include\
the mq4 should be in \mql4\libraries\
in your build 600 Empty4 directory
Image
Post Reply

Return to “Coders Hangout”