› Forums › Development › Trading made REALLY Simple: Coder's Chat
Tagged: Penguin Community EA
- This topic has 169 replies, 16 voices, and was last updated 9 years, 11 months ago by
pipatronic.
- AuthorPosts
- January 21, 2016 at 9:42 am #11164

I hope to be ready for inspection sometime over the weekend, I’ve entirely rewritten the file parsing and calling function, – now going to look at tidying up the xml file download. (slowly removing all the globals etc
)I love tidy coding!
I am unsure how the EventSetTimer in an indicator affects the calling EA
If the EventSetTimer method of an indicator called by iCustom affects the timer event handling of the calling EA … that would be what I consider a mega-bug. It should not happen.
But the original plan was (if I’m not wrong) to have not only a news indicator, but to compile it to a callable stand alone function for EA use as well. For such a function, it’s a different kind of story. Inside one EA or indicator, you can only have one timer instance, which is a serious limitation, IMO. I have no idea why those guys at MQ implemented it in such a crappy way.
If more than one timer is required, it could be done by coding a little multi-instance timer lib … shouldn’t be that complicated.
s.
A good trader is a realist who wants to grab a chunk from the body of a trend, leaving top- and bottom-fishing to people on an ego trip. (Dr. Alexander Elder)
January 21, 2016 at 11:08 am #11167Yes , that’s what I’ve been thinking . The function is simply called on a as need basis – . The indicator is purely to show the function working. The indicator has a timer event implemented by I’ll remove it and run it through the OnCalculate and run a one minute timer of sorts in there. The lowest possible resolution of the calendar is one minute so there is no need to poll it any faster than that, – or just before entering a trade.
A multi-instance timer lib sounds interesting. I think it could be useful.
I usually implement a timer of sorts in my EAs -( most of them pre – ver600 ) in an effort to lighten the load on the PC / VPS.
January 21, 2016 at 3:26 pm #11173I think that xux99 implemented a call to FFCAL in his Orcus EA, but not sure.
G.
January 22, 2016 at 1:22 am #11179I think that xux99 implemented a call to FFCAL in his Orcus EA, but not sure. G.
Hi G,
You are right about this, i found it at Rossbot EA some months ago … tried to change some variables and functions name at that time, but as i tested it after that, i still got so success … i think i should see it again …
input string FFCal_settings = “———————————————————————-“; input bool IncludeHigh = true; input bool IncludeMedium = true; input bool IncludeLow = false; input bool IncludeSpeaks = true; input bool ReportAllForUSD = false; if (NewsFilter0) { t1=1; while(t1<=4) { OTime[t1]=0; t1++; } MinutesUntilNextEvent=iCustom(Symbol(),PERIOD_CURRENT,”FFCal”,IncludeHigh,IncludeMedium,IncludeLow,IncludeSpeaks,true,0,true,-1,-1,ReportAllForUSD,1,1); MinutesAfterPrevEvent=iCustom(Symbol(),PERIOD_CURRENT,”FFCal”,IncludeHigh,IncludeMedium,IncludeLow,IncludeSpeaks,true,0,true,-1,-1,ReportAllForUSD,1,0); if (MinutesAfterPrevEvent!=99999) { OTime[1]=OTime[22]-(MinutesAfterPrevEvent+MinutesBeforeNews)*PeriodSeconds(PERIOD_M1); OTime[2]=OTime[22]-(MinutesAfterPrevEvent-MinutesAfterNews)*PeriodSeconds(PERIOD_M1); } if (MinutesUntilNextEvent!=99999) { OTime[3]=OTime[22]+(MinutesUntilNextEvent-MinutesBeforeNews)*PeriodSeconds(PERIOD_M1); OTime[4]=OTime[22]+(MinutesUntilNextEvent+MinutesAfterNews)*PeriodSeconds(PERIOD_M1); } t1=1; while(t1<=4) { OTime[t1]*=((OTime[1]>0 || OTime[3]>0) && OTime[1]!=OTime[3]); t1++; } }January 22, 2016 at 2:16 am #11180Asymmetic ATR channel is interesting … any information how to learn more about it ?
Thanks in advance ..
January 22, 2016 at 8:56 am #11183Asymmetic ATR channel is interesting … any information how to learn more about it ?
At the moment only in my brain or on my hard disk. I will post my version later this morning. Stay tuned, please!
s.
A good trader is a realist who wants to grab a chunk from the body of a trend, leaving top- and bottom-fishing to people on an ego trip. (Dr. Alexander Elder)
January 22, 2016 at 11:27 am #11186Attached is the News calendar function and sample indicators.
derived from ffcal ; though I’ve rewritten most of it.
No timers are used in this function or indicators anymore.
Future version of it should be able to read in past calendar files.
the 2 sample indicators:
DisplayNews: as per Emonts, just shows a coloured panel green for all clear, yellow,orange then red for higher impact news.
DisplayNewsImpactLine: Shows a indicator trace on subwindow, indicating impact level, also comment on the top left of current news Item details. The trace doesn’t load any past data so, set the chart for 1 minute to see the trace add data in real time. The EA could read from the [0] element of this indicator or call the function itself.
Attachments:
You must be logged in to view attached files.January 22, 2016 at 11:48 am #11188I wish I re-read this forum thread. I’ve only now seen your comments on file sharing and web access aspect of the newscal.. I’ll look at this aspect over the weekend. Should be simple enough, using the MQL’s GlobalVariables with some sort of random time init to grab control of the web downloading. etc.
January 22, 2016 at 11:51 am #11189Great one:
Attached is the News calendar function and sample indicators.
You announced tidy code … I found tidy code. I really appreciate that!

Just one little remark about your input dialog – see pics. Your internal remarks (30, 15) are not very informative on the user’s side. I would suggest to replace
sinput int minutesBeforeNews = 150;//30 sinput int minutesAfterNews = 500;//15by
sinput int minutesBeforeNews = 150; // minutes before news sinput int minutesAfterNews = 500; // minutes after newss.
Attachments:
You must be logged in to view attached files.A good trader is a realist who wants to grab a chunk from the body of a trend, leaving top- and bottom-fishing to people on an ego trip. (Dr. Alexander Elder)
January 22, 2016 at 11:58 am #11192@fuzzy:
I wish I re-read this forum thread. I’ve only now seen your comments on file sharing and web access aspect of the newscal.. I’ll look at this aspect over the weekend.
Looking at the way you’re addressing the ‘news problem’ makes me feel confident that everybody can relax now about this topic. It’s obviously in good hands!

Enjoy your weekend … looking forward to your further contributions!
s.
A good trader is a realist who wants to grab a chunk from the body of a trend, leaving top- and bottom-fishing to people on an ego trip. (Dr. Alexander Elder)
January 22, 2016 at 1:04 pm #11195On Currency-Strength:
Since we are going to use Currency-Strength as part confirmation for Entry/Exit, I’d like to share my view on the subject of Currency Market Share.
I already introduced the USDx, which is the Dollar Index, based on US Trade basket of US trade partners currencies, and the way it’s calculated.
I’m using the same calculation method to create my own FX USDx Index – but this one is more adapted to the Forex market.
The Data:
FX Market Share by Major Currency (%):
————————————————-
USD: 87.0 -> 49.5465
EUR: 33.4 -> 19.0213
JPY: 23.0 -> 13.0985
GBP: 11.8 -> 6.7201
CHF: 8.6 -> 4.8977
CAD: 5.2 -> 2.9614
AUD: 4.6 -> 2.6197
NZD: 2.0 -> 1.139
————————
Total %: 175.6 / 2 = 87.8 * 1.139 = 100%* Because two currencies are involved in each transaction, the sum of percentage share of individual currencies totals 200 percent.
We devide the total by 2, and modify the result to 100% using a calculated factor of 1.139.
Now we devide each currency % by 2 and multiply it by the factor to get its FX Majors market share.What you have after the “->” is the currency % share AFTER such calculation.
————————————————————————————————————————————————————FX Market Share by Major Currency pair (%):
——————————————————
USD/EUR 24.1
USD/JPY 18.3
USD/GBP 8.8
USD/AUD 6.8
USD/CAD 3.7
USD/CHF 3.4
USD/NZD 1.5EUR/JPY 2.8
EUR/GBP 1.9
EUR/CHF 1.3
——————————————————————————————————————————Now you can create your own FX USDx , based on the same calculation method as in the original USDx, which is more adapted to Forex market Major currencies and pairs.
G.
January 22, 2016 at 9:18 pm #11196Thank you for sharing your model! I tried to understand it and compiled your numbers into a spreadsheet – see attachment. I’m getting slighly different numbers, maybe I misunderstand some detail.
USD/EUR 24.1 vs. 27.2
USD/JPY 18.3 vs. 18.7
USD/GBP 8.8 vs. 9.6
and so forth …Could you give me some feedback regarding the spreadsheet attached?
s.
Attachments:
You must be logged in to view attached files.A good trader is a realist who wants to grab a chunk from the body of a trend, leaving top- and bottom-fishing to people on an ego trip. (Dr. Alexander Elder)
January 22, 2016 at 10:44 pm #11216@gg53: Thank you for sharing your model! I tried to understand it and compiled your numbers into a spreadsheet – see attachment. I’m getting slighly different numbers, maybe I misunderstand some detail. USD/EUR 24.1 vs. 27.2 USD/JPY 18.3 vs. 18.7 USD/GBP 8.8 vs. 9.6 and so forth … Could you give me some feedback regarding the spreadsheet attached? s.
Those numbers are from the BIS (The Bank for International Settlements), and NOT calculated.
Their sum is 66.6%, and I scale them to 100% and calculate each pair by that factor.
I use in both a Stand-Alone USDx indicator and my Spaghetti indicator.
I never trade AGAINST the USDx indie.
G.
January 22, 2016 at 11:18 pm #11217Ok, thank you! That upscaling will obviously be trivial. I assume the numbers are from this report (p. 5).
But after that step I’m afraid we might get stuck at a similar point of discussion like weeks ago, when we failed to define a common view about the proper algorithm to implement those numbers.
At the moment I’m having no new idea regarding that detail. So maybe I’ll step back for a while and hope somebody else with a clever idea might show up from his or her hideout.
s.
A good trader is a realist who wants to grab a chunk from the body of a trend, leaving top- and bottom-fishing to people on an ego trip. (Dr. Alexander Elder)
January 22, 2016 at 11:54 pm #11218Ok, thank you! That upscaling will obviously be trivial. I assume the numbers are from this report (p. 5). But after that step I’m afraid we might get stuck at a similar point of discussion like weeks ago, when we failed to define a common view about the proper algorithm to implement those numbers. At the moment I’m having no new idea regarding that detail. So maybe I’ll step back for a while and hope somebody else with a clever idea might show up from his or her hideout. s.
Here are my USDx with and without (Plain) market share.
Note that USDx weighted indicator is currently pointing up (correct) while the other one is pointing slightly down (current Friday close).
I use the weighted one for my ForexGT_Spaghetti CS indicators.
Just replace the std. USDx in your CIX calculations with this one (or similiar method) and you are on the right way.
G.
Attachments:
You must be logged in to view attached files.January 23, 2016 at 2:54 am #11224Here are my USDx with and without (Plain) market share. Note that USDx weighted indicator is currently pointing up (correct) while the other one is pointing slightly down (current Friday close). I use the weighted one for my ForexGT_Spaghetti CS indicators. Just replace the std. USDx in your CIX calculations with this one (or similiar method) and you are on the right way. G.
Thanks a lot G.

@simplex : Thanks for your zip file
@fuzzy : Thanks for NewsCal code
January 23, 2016 at 8:21 am #11225Hi all
This is a new version of the New Calendar function +.
- File sharing / locking done.
- Web access locking done.
- Locks clearing protocol .
- Calendar history loading implemented. (see displayNewsImpactLine indicator)
on indicator chart,
-1 – no history
0 – no news
1 – low impact
2 – med impact
3 – high impact
- Calendar history loading implemented. (see displayNewsImpactLine indicator)
Calendar files will get saved in the Files folder as expected.
I have included this weeks calendar file as a start to the history bank should you desire.
Simplex: I had no idea that the comments on the sinput line get displayed that way. Thanks for that.

I could improve the way loading history works, currently it reads the file each access. I’ll think about that tomorrow.
Attachments:
You must be logged in to view attached files.January 23, 2016 at 8:26 am #11227What the DisplayNewsCalendarImpactLine indicator looks like (loading history bars)
the image shows with the trace at -1 (no history) then the different impact levels
-
This reply was modified 10 years, 4 months ago by
fuzzy.
-
This reply was modified 10 years, 4 months ago by
fuzzy.
Attachments:
You must be logged in to view attached files.January 23, 2016 at 8:47 am #11232January 23, 2016 at 9:42 am #11234On Currency-Strength: USD/EUR 24.1 USD/JPY 18.3 USD/GBP 8.8 USD/AUD 6.8 USD/CAD 3.7 USD/CHF 3.4 USD/NZD 1.5 EUR/JPY 2.8 EUR/GBP 1.9 EUR/CHF 1.3 ——————————————————————————————————————————
fun bar based index which i tried to add your weights. ( sorry if this is a tad off topic :) )
Attachments:
You must be logged in to view attached files.“I believe the very best money is made at the market turns. Everyone says you get killed trying to pick tops and bottoms and you make all
your money by playing the trend in the middle. Well for twelve years I have been missing the meat in the middle but I have made a lot of
money at tops and bottoms.”
– Paul Tudor JonesJanuary 23, 2016 at 10:44 am #11237@fuzzy:
I had no idea that the comments on the sinput line get displayed that way.
Note that this only works with
#property strictset, otherwise the variable name will be displayed. I like that feature because it provides much more freedom to design a good user interface in the input dialog.Thanks for your new version. Your description sounds more than good and I will check it out during the weekend!
s.
A good trader is a realist who wants to grab a chunk from the body of a trend, leaving top- and bottom-fishing to people on an ego trip. (Dr. Alexander Elder)
January 23, 2016 at 10:55 am #11238Just replace the std. USDx in your CIX calculations with this one (or similiar method) and you are on the right way.
Thanks, will give it a try!
s.
A good trader is a realist who wants to grab a chunk from the body of a trend, leaving top- and bottom-fishing to people on an ego trip. (Dr. Alexander Elder)
January 23, 2016 at 12:25 pm #11243Just replace the std. USDx in your CIX calculations with this one (or similiar method) and you are on the right way.
Thanks, will give it a try! s.
The numbers I used in this indicator are from “Global foreign exchange market turnover by currency pair”, Table #3 – from here: http://www.bis.org/publ/rpfx13fx.pdf.
G.
January 23, 2016 at 1:01 pm #11244Ok, first of all I tried to get a grip on your ‘never trade against it’ rule, and failed. Maybe it’s just my noob interpretation of what that rule really means.
Some USD based examples on H4, showing your plain and USDx version of ForexGT Dollar Index.
- AUDUSD: nearly perfect, but the reversal at the right end seems to be better resolved by the ‘plain’ version.
- EURUSD: not so perfect, looking at the left end, perfect for the rest. And again: the reversal at the right end is better resolved by the ‘plain’ version.
- GBPUSD: absolutely perfect.
- USDCAD: nearly perfect, but the reversal at the right end appears to be better resolved by the ‘plain’ version.
- USDJPY: trend lines on the indicators are contrary to price trend.
You seem to be very confident about your rule, so my simple interpretation is probably wrong. What does ‘never trade against it’ really mean?
s.
-
This reply was modified 10 years, 4 months ago by
simplex. Reason: Correction of USDJPY discussion!
Attachments:
You must be logged in to view attached files.A good trader is a realist who wants to grab a chunk from the body of a trend, leaving top- and bottom-fishing to people on an ego trip. (Dr. Alexander Elder)
January 23, 2016 at 1:13 pm #11251Yes:
The numbers I used in this indicator are from “Global foreign exchange market turnover by currency pair”, Table #3 –
The same link as mine – thanks for confirming!
s.
A good trader is a realist who wants to grab a chunk from the body of a trend, leaving top- and bottom-fishing to people on an ego trip. (Dr. Alexander Elder)
- AuthorPosts
- You must be logged in to reply to this topic.