Pending orders Script.. inconsistent.. Help please?

Post Reply
opieness
Posts: 8
Joined: Fri Jun 22, 2012 1:55 am

Pending orders Script.. inconsistent.. Help please?

Post by opieness »

My first post so HELLO!!

Hope someone will please give me a hand with this one...

This script adds all 4 types of pending orders at a specific time around the open price of that time. (I'm there soon after that time to place the script every day) A red vertical line marks the time, a white dotted line marks the open price plus half the spread. The "inner pips" is how far the sell limit and buy limit orders are from the white line. The "outer pips" is how far the sell stop and buy stop orders are from the white line.

I finally got this to work correctly.. BUT sometimes I have to attach it a few times before my lines get drawn and/or my orders get placed. Sometimes the first time I add it, the price line and orders go in at the wrong price. Applying it again usually fixes it, IF it places the orders at all. My knowledge of code, so far, is basically getting done what I've got done so far :shock: ..

I've looked at other scripts and see that orders are placed multiple times till they get placed, but that's where I get a bit lost.. I use this script on 12 pairs with all different inner and outer distances, so can someone please help with this so the script will run correct the first time I drop it on a chart?? It takes long enough to go thru the process without doing it multiple times....

Thanks so much and appreciate ANY help!!!
Ralph
You do not have the required permissions to view the files attached to this post.
opieness
Posts: 8
Joined: Fri Jun 22, 2012 1:55 am

Re: Pending orders Script.. inconsistent.. Help please?

Post by opieness »

It's only fair that I share some background to why this script is important if I'm asking for help!!.

I somehow found a trader's site that offered a few free trading strategies as learning tools for his Hedge Report, the paid portion of the site. There's no affiliates and no marketing hype. I'm NOT making ANY money promoting the site and don't even want to mention the actual name....

Anyway, the concept & description was intriguing, so I paid the fee to gain access.. The report was on version 2 at this point. At the same time every night, a list of trades came out and you placed your orders.. no s/l, no t/p & no pending orders.. The drawdowns were not bad, but could be a little scary. There was a bad one just before I joined. I was up 39% after 2 1/2 months on demo when he came out with version 3. I would've gone live after month 1, but he announced Version 3 was coming and to go live then if you hadn't yet. So I've been waiting..

Version 3 is supposed to be more profitable with smaller drawdowns, but it's centered around 4 pending orders on 12 pairs every night.. So I'm trying to stream line the process a bit for Empty4.. The lots and order distances from the open change daily based on his calculations, so an EA is out of the question. But 15-20 minutes a night to manually place these orders (with this script of course) for the returns I've seen.. Definitely worth it!!

I repeat.. I'm not a marketer!! Just sharing something I think works.. Go ahead and google Forex Hedge Report for yourself to find it and review. There are some sites with bad reviews of his systems and him, but I don't believe them for a second. Thru a blog on his site, he has worked hard to personally make sure EVERYONE understands the process.. and I mean EVERYONE!!

Anyway if any of this is inappropriate for this forum, please do what you gotta..
Thanks!!
Ralph
garyfritz

Re: Pending orders Script.. inconsistent.. Help please?

Post by garyfritz »

I glanced quickly at your script. Your PipAdjust code is wrong. To turn a price into pips, you multiply times 100 for all JPY pairs, and times 10000 for all non-JPY pairs. The MODE_DIGITS value is irrelevant. E.g. a 4-digit crim might report a spread of 0.0002 and a 5-digit crim would report the same value as 0.00020. Multiply either one times 10000 to get 2.0 pips.

However the MODE_SPREAD value is in points. If you wanted the Spread in pips, you'd divide it by 1 or 10, depending on the crim digits. But you're adding the spread calculation to a price anyway -- you don't want it in pips! You want an actual price value, and you get that from spread*Point.

However: the Spread returned by MarketInfo() is a fantasy. I just displayed the MODE_SPREAD value and the actual (Ask-Bid) value for AUDCAD. MODE_SPREAD said it was 1.4 pips. Actual spread at the moment on my crim is 6-8 pips. So I wouldn't use that MODE_SPREAD value for anything real.

And you shouldn't always add the spread to the recent price anyway -- it depends on if you're buying or selling.

Those errors will result in a bogus TradePrice. I haven't traced through the code to see what result it would have but it can't be good. It's possible that might have caused your problems.

I would dump the spreadfix stuff for now. Just go with the iOpen() value and see how that works. There could be more change between iOpen() and the current close than the spread would have corrected anyway. See how that works.

Since this guy is selling a subscription, I assume he doesn't teach you how to trade the system yourself? You have to rely on him to deliver the trades every night?
opieness
Posts: 8
Joined: Fri Jun 22, 2012 1:55 am

Re: Pending orders Script.. inconsistent.. Help please?

Post by opieness »

Thanks Gary,

Obviously I'm NOT a programmer and apparently not too good with math. You're pipadjust explanation makes complete sense and I'll fix that. Points and pips.. that's probably why I couldn't get my original spread equation to work, and that's why I ended up using MODE_SPREAD. l verified it was giving the correct spread a few times, but it must've been a coincidence.

As far as adding the spread, I thought the displayed price was always the bid price, so it wouldn't matter if there was a buy or sell. The idea is to "eliminate" the effect of the spread by taking the midpoint of the spread across a ton of buy and sell orders to average it out.

As for the system itself, he's apparently utilized years of data and from his website: "How Does Rapid Forex Portfolio Hedging Work? It’s actually *rocket science* This isn’t a joke, the equations are similar to what is used in flying a rocket to the moon." All I know is that the info he provides works. I like a product or system that I can get into and learn also, but this an addition to the portfolio because it's different, tested it myself and it actually works. It's definitely not for everyone, but what is?

Thanks for your help Gary, I appreciate it!!
garyfritz

Re: Pending orders Script.. inconsistent.. Help please?

Post by garyfritz »

Ah, of course. Yes, adding spread/2 (if spread was valid) to the bid should put you between the bid and ask. But since MODE_SPREAD is fantasy, you'd be better off to use (Bid+Ask)/2.

You didn't answer my question -- does he teach you how to trade the system without his subscription, or does he just provide signals?
opieness
Posts: 8
Joined: Fri Jun 22, 2012 1:55 am

Re: Pending orders Script.. inconsistent.. Help please?

Post by opieness »

Ya, I'll fix the pipadjust, thanks!!

Oh sorry, no, you can not trade the system without the subscription. I'm sure this is simplifying it, but I believe the system is more like a spreadsheet with formulas that utilize past prices and current prices, and somehow compares the 12 pairs to create a hedged system. What we see is what the spreadsheet spits out every day. It gives us the lots to use on each pair, with a level system based on our account size and how the formulas apparently weigh the pairs. It also has the Inner and Outer pips and that's it. We check it every night and place our trades on every pair accordingly.

He's VERY responsive and willing to help everyone to understand what they need to know. He's explained some of the thinking behind it before and it doesn't sound like something that could be programmed to Empty4, but I may be wrong... I know he uses Trade Station at FXCM and isn't a huge fan of Empty4, but knows most peeps use it.

Thanks again
baliguy
Posts: 2
Joined: Wed Mar 06, 2013 5:26 pm

Re: Pending orders Script.. inconsistent.. Help please?

Post by baliguy »

Hi,
Is anyone still trading HedgeReport? I'm a "lifetime" member, but if you are also, you know it is not active. I'm still hoping Brian will come thru.
baliguy
Posts: 2
Joined: Wed Mar 06, 2013 5:26 pm

Re: Pending orders Script.. inconsistent.. Help please?

Post by baliguy »

Opieness, are you back up and trading this? I am doing great with this now that I have my own copy, using data from my own broker (OANDA), at my own time (7am est). However, it does take almost an hour to put the data in, transfer it and manually place pending orders. Is 11% gain per week good? I know there will be weeks of drawdown of coarse.
I will be working on a script to put the daily ohlc data in a spreadsheet or text file. I can then paste in the HR3 spreadsheets. From there I want to paste the prices for the pending order prices in a script and have the script place all the orders. I suppose all of this can be brought together in a script or ea at some point including closeing all current and pending just beforehand.
Post Reply

Return to “Coders Hangout”