GoldnOil750's avatar
GoldnOil750
GoldnOil750's avatar

Info

Username:GoldnOil750
Name:GoldnOil750
Member since: 07 Apr 2015

About

None

Signature

None

Last Algorithm Comments

@Robot for Trend and Range periods:  12 Nov 2020, 08:32


Hi Astevani,

need to develop few cBOTS...  I know basic programming but for these cBOT need some professional help. I am willing to pay also and not looking for some free service.

Please contact me on skhan.projects@gmail.com

thank you

GoldnOil

@SK1 - Moon Chaser - v1:  14 Aug 2019, 12:02


Hi,

I have shared the download link...  download it from there and use it on demo accounts...

@SK1 - Moon Chaser - v1:  29 Jul 2019, 10:40


mind over matter.
You don't like something, simply move on. don't spoil this community. Get a life !

@SK1 - 28 Pairs Volatility -:  12 Oct 2017, 13:10


I do have logics;  But my point in building this cBOT was bascially
(1) To display information in groups;  so one knows which MAJOR-PAIR is strong;
(2) A basic template / framework which is ready to be converted into a Trading robot, once point #1, is all set.

In my experience, we need to first see the data and see if it is aligned with our "Entry Rule" for a trade.

@SK1 - 28 Pairs Volatility -:  12 Oct 2017, 06:58


It does not place any orders.  It is upto you to further develop it and add more data to make a decision when to trade or not.

@Enhanced Deal Map:  29 Apr 2017, 10:59


Do you have Skrill account.  Payment for your work can be made there also.  don't have Paypal.

 

thank you

///S.Khan

@Self updated Asia/Europe/US Market Hours:  29 Apr 2017, 10:31


Thank you.  very nice clean code.  If you can insert extension methods that can be used in cBOT like

bool Flag_Londong =  ForexMarketHours.isLondon();

then this indicator can be of great use.  

anyways, great work.

///S.Khan

@Lazy Bear Centre of Gravity:  15 Jan 2017, 16:56


Hi Elogos,

can you check this job I posted. http://ctrader.com/jobs/537

It is similar work as you did on Bekh.Timing indicator.  Maybe you can do this with ease.

thank you.

///S.Khan

@1SK - Display Pair Info on Top of Chart:  18 Nov 2016, 05:05


Hi,

my email address is skhan.projects@gmail.com

sorry for the late reply.

///S.Khan

@Intermarket - 8 Major Pairs Strength:  12 Apr 2016, 10:47


Hi,

you can contact me on "skhan.projects@gmail.com".

@Market Hours:  01 Apr 2016, 13:04


PERFECT !!!  working just fine.  haven't checked its accuracy......   (*just noticed that NEW YORK will open at 18:00 hours as per my local time, but actually NEW YORK will open around 17:00 hrs.    Can you check that or any user-input where  a user can add +1 or -1 to get the correct time, if there is error.

 

thank you !

@Intermarket - 8 Major Pairs Strength:  30 Mar 2016, 17:58


Hi Kenny,

can you please run on any other broker's platform like www.roboforex.com or www.fxpro.com.  

It takes time to load the OPEN PRICES, but it is like 4 to 5 mins but then it updates the prices within mili-seconds. A issue that has been raised with SPOTWARE several times.

 

thank you

///S.Khan (Pakistan)

@Intermarket - 8 Major Pairs Strength:  30 Mar 2016, 17:39


I have been running it successfully on RoboForex and FxPro cTRADER demo account.  Can u download & run it on a demo account of another Broker ?

thank you.

///S.Khan

@Intermarket - 8 Major Pairs Strength:  30 Mar 2016, 16:48


Hi Dmd and FT,

The problem seems that your cTRADER platform does not have all the Symbols available for trading.  There should be all 28 Pairs (8-Major and their 7 crosses.  Major = (check screen shot above)  available for trading on your platform.  Are u guys using swap-free account ?  As in those type of account CHF pairs are not available, i think.

 

You can disable the code where CHF pairs are required in the METHOD  " Get_28Pair_Symbol".  But again, how many pairs are you going to disable; as the basic use of this "information regarding strength per time frame" will be useless.

 

thank you.

///S.Khan 

@Intermarket - 8 Major Pairs Strength:  29 Mar 2016, 21:49


Hi FT,

check the cBOT Log;  I am sure it must be stuck on getting the Open Prices.   This is a serious issue with cTRADER/cALGO  platform; OPEN PRICES do not load quickly for the first time and some time they simply don't and you have to again restart the cBOT.

///S.Khan

@Intermarket - 8 Major Pairs Strength:  29 Mar 2016, 17:54


Hi,

you have to wait....   due to cTRADER internal issue; First Time "Open Prices" take a few mins to load and if it news time, the cTRADER is unable to fetch the prices.  But once loaded, it moves flawlessly.

you have to wait a few mins....  

@Market Hours:  28 Mar 2016, 18:07


Hi,

it compiled but it is not showing the table as shown in your chart screen shot.  It only display 3 very small grey color boxex, with blank, 1, 2 written on it, on the top right corner of the Chart.  (*tried with RoboForex and FxPro ctrader platform. same result.

@Market Hours:  26 Mar 2016, 06:47


It is not compiling.  Giving Error on 84 onwards.

@Reading Excel Data To Open New Trades:  25 Dec 2015, 14:58


HI Paul, again Great Work.

Any help on how I can get/access one new row when a new "OnBar" Method is called.   My data is in the Excel file rows. I want to pick one row at a time per "OnBar"....

///S.Khan

@DreamzFX Position Manager 1.0.1:  26 Sep 2015, 09:53


Hi,

I need a simple cBOT. Can you please check the link with the description Payment will be made through SKRILL.

http://ctrader.com/jobs/252

 

thank you

Saleem Khan

@Dump trendbars data to CSV:  26 Sep 2015, 09:51


Hi,

I need a simple cBOT. Can you please check the link with the description Payment will be made through SKRILL.

http://ctrader.com/jobs/252

 

thank you

Saleem Khan

Last Forum Posts

@What's New in cTrader Desktop 3.6:  08 Oct 2019, 15:41


Panagiotis Charalampous said:

Hi GoldnOil750,

The issue usually occurs when a lot of drawings remain on the chart, usually forgotten from another setup. We usually ask for the settings file to confirm this. In case such a behavior occurs again, just make sure there are no forgotten drawings on the chart.

Best Regards,

Panagiotis

OK.  Thank you!!!

@What's New in cTrader Desktop 3.6:  07 Oct 2019, 19:38


Panagiotis Charalampous said:

Hi GoldnOil750,

Thanks. Can you also send us your settings file at community@spotware.com? You can find it at C:\Users\UserName\AppData\Roaming\broker cTrader\Settings.

Best Regards,

Panagiotis

Hi,

I just deleted the settings file "Default" and restarted the Broker's cTrader (Trader's Way) and it is working fine and I don't see lot of memory being occupied.. . its under 700 MB and the CPU usage is drastically reduced to under 5% when no volatility....

maybe, deleting this file was the trick....   maybe, a simple button in the cTRADER platform where user can delete these type of files and restart the Platform to see if the performance and freezing issue is resolved.....

Thank you

@What's New in cTrader Desktop 3.6:  07 Oct 2019, 19:15


Panagiotis Charalampous said:

Hi GoldnOil750,

Thanks. Can you also send us your settings file at community@spotware.com? You can find it at C:\Users\UserName\AppData\Roaming\broker cTrader\Settings.

Best Regards,

Panagiotis

Hi,

have sent the email....  

@What's New in cTrader Automate API 3.6:  07 Oct 2019, 10:25


I sincerely believe that Spotware should look inwards by start comparing their PLATFORM with another platform like MT4 interms of performance and execution speed rather than in terms of beauty....

still today during a little volatility the platform will freeze and will not let you do anything....  by adding a few indicators and multiple chart the Platform overall response time increases and one experiences frequent delays....

I think its time that they do a side by side comparison of their Platform with MT4 in terms of performance with multiple charts, indicators and during news time...  and I am sure within minutes you will know where your Platform stands....

No#1 thing every real trader wants is smotth performance without any freezes or slowing down due to multiple chart or indicators.....  

anyways, I am saying that for number of years but still haven't seen any improvement in performance....    the GUI and few features are very good and very trader friendly.

@What's New in cTrader Desktop 3.6:  04 Oct 2019, 20:57


Hi Panagiotis,

have copied the this link and submitted my request by pressing Ctrl+Alt+Shift+T......      this time I opened more Charts on this ver 3.6 and the memory usage has crossed nearly 2gb at times and using 31% of CPU alone, while the total CPU usage is 45%....    so you can imagine how much load it is putting on the CPU and the cores run hot...    Its Friday night and no news or volatility going at the moment but the cTRADER is not responsive and very slow in switching between charts....

also, after  a while I got an error message also which I have taken the screen shot and pasted here...

Thank you

SKhan

@What's New in cTrader Automate API 3.6:  04 Oct 2019, 05:49


Hi,

the new version is highly unstable and eating around 1.3 GB Memory and upto 40% of CPU time (it fluctuates a lot)....   ver 3.5 was ok and more stable.  Have attached the screen shot of the cTrader ver 3.6 from TradersWay compared to ver 3.5 from IC Market and FxPro and you can see how much memory and CPU % each is using....

only one chart is opened on TradersWay cTrader Platform ver 3.5 while FxPRo and IC Markets have many charts and indicators attached. Have un-installed and re-installed the TradersWay cTrader ver 3.6 platform also but no improvement...  right now the market is very calm but still it is highly CPU hungry....

I am using core i7 4th gen CPU with 16GB mem and a SSD hard drive.  

hope Spotware fixes this issue before more Broker release this version or if Spotware and others can attach a screen shot of the memory usage from different brokers and maybe something is wrong at TradersWay Brokers cTrader platform...

Regards,

SKhan

@What's New in cTrader Desktop 3.6:  04 Oct 2019, 05:44


Hi,

the new version is highly unstable and eating around 1.3 GB Memory and upto 40% of CPU time (it fluctuates a lot)....   ver 3.5 was ok and more stable.  Have attached the screen shot of the cTrader ver 3.6 from TradersWay compared to ver 3.5 from IC Market and FxPro and you can see how much memory and CPU % each is using....

only one chart is opened on TradersWay cTrader Platform ver 3.5 while FxPRo and IC Markets have many charts and indicators attached. Have un-installed and re-installed the TradersWay cTrader ver 3.6 platform also but no improvement...  right now the market is very calm but still it is highly CPU hungry....

I am using core i7 4th gen CPU with 16GB mem and a SSD hard drive.  

hope Spotware fixes this issue before more Broker release this version or if Spotware and others can attach a screen shot of the memory usage from different brokers and maybe something is wrong at TradersWay Brokers cTrader platform...

Regards,

SKhan

@cTrader Desktop 3.5 Provides More Usability with a New Look:  08 Jun 2019, 11:15


Please stop with this interface changing...  It really get on Trader nerves as a trader to get acquainted with the new interface...   atleast decide it for once and stay with it atleast for a year or two before a major shuffle....  I don't understand the obession with this.

1. also, please in the cALGO Backtesting section, clicking to open window every time we change a parameter is very tedious especially when we are doing backtesting.  Can you stick to the old interfae where we can have a look at the parameters of cBOT while backtesting...  that would be great.

2. There is some bug where the old cBOT are now crashing on backtesting after compiling the old code. It gives this error

"07/01/2019 09:00:00.000 | Crashed in OnBar with TypeLoadException: Could not load type 'cAlgo.API.SymbolInfo' from assembly 'cAlgo.API, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3499da3018340880'."

3. Reduce the "NUMBER OF CLICKS" or scrolling a TRADER/BackTester has to do to get a the most common task done required frequently.  But everytime a new interace changes where we have to click more to get a task done.  Just take for example;  the bell icon was visible all the time and it was easy to know that if we have muted it or not...  now we have to make one extra click to mute/unmute the sound.

4. The list of Accounts placement is changed;  I think most will agree that older one was good and we could see which accounts are attached to CTID .....  

anyways, please solve the Point #2 at your earliest......

Thank you

@Does cTRADER support Multi-Core & Threading:  23 Feb 2019, 06:52


Hi Andrey and Conno123,

hope you guys are well.  There is no doubt cTRADER has improved a lot.  Having said that doesn't means that the core issue, the NUMBER ONE reason which can turn the serious trader away is platform performance.

As Andrey said if we can share something with him to reproduce the lagging or freezing issues.  Very simple, just add  3 Moving Averages on the Chart and Two indicator like MACD and STOCH.  Open atleast 10 to 12 pairs and apply these indicators.  Just wait for small news in which certain GBP or EUR pair is moving a little faster and you will see that the platform freezes in terms :  (1) Cannot switch between pairs  (2) Opening a new Chart will not load the candles data...  

Just download the cTRADER platform from a broker like FxPro or IC Market or RoboForex....  do not use your own Spotware cTRADER platform.

Unfortunately, cTRADER is spendig more time on beautification of the platform and changing the UI constantly. 

        1. The new changes like the "TABS",  they are very long...   we can only fit 4 or 5 charts and then have to scroll from left to right which is very annoying.

        2. Sound button and other features that were first accessbile on a single click, but now are accessible on 2 or more clicks.

For a trader to get familiar and comfortable with the UI and suddenly you change it, can turn away traders and tell them that SPOTWARE cannot makeup its mind.  We are traders and would appreciate that less click and scrolling to get the most needed things or atleast allow the Trader to customize the ribbon as per his ease of use.

BUT HAVING said that the number one issues remain the PLATFORM freezing and slow response with just the basics default indicator.  If we go on adding 3rd party cBOTs or Indicators the platform crashes and we have to force terminate it.

I think and propose that cTRADER make a pool of volunteers (real traders i.e. the end users. not the coders) who are willing to give suggestions on the UI and can test the performance. They have a direct link with SPOTWARE and a weekly engineering call where performance issues can be discussed.  These kind of development where inviting the community and engaging the real traders will help.

If you just look at the PREVIOUS threads where i have shared a IMAGE of a dashboard from MT4, trust me in cTRADER we cannot achieve 10% of that also while MT4 runs all that and more without even sweating a drop whether there is volitality on few pairs or all pairs.  You can try yourself and go on ForexFactory and download the "Dashboard" on the thread "https://www.forexfactory.com/showthread.php?t=532236".


I have been saying this for a long time and now I am tired as if things are going to move so slow in this direction.... it is better to use MT4 while we wait for a more stable and fast cTRADER platform.

Its a beautiful UI but with the worst peformance issues when volitality increases on even 2 to 3 pairs.

regards,

///SKhan
 

@Slowest Release cTRADER upgrade version:  07 Jul 2017, 09:07


Thank you.

it was a local problem related to my computer.  How did I fix it...?   I unistalled the cTRADER but that didn't alone solve the problem.

I had to go to hidden folders in Users Account, Roaming and search for the cTRADER folders related to my BROKERS and delete them all. 

C:\Users\YourName\AppData\Roaming

And then only everything was removed and then did a fresh installed again.

I wish cTRADER implements this in their uninstaller by removing every folder as those folders in USER Accounts were making a new installation of cTRADER useless and only by removing those folders, does the cTRADER works properly on fresh installation.

Charts were loading properly and were fast and even the cBOTS were working great.

so everyone out there you have to unistall and then manually remove those hidden folders in your User Account, and AppData\Roaming.. also, which I think cTRADER should do it by default in their own uninstaller (and give users options for complete removal or leave the data/settings folders ).

thank you.

Notification Publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section you may use the Copyright Infringement Notification form to submit a claim.
free  05 Jul 2017
Hi, a simple indicator that displays Pair Info on top of the Chart.  Kinda Helpful information for Traders. Information Displayed are : 1. Pips Current and Closed  2. Unrealized and Closed Net P/L 3. Pip Cost  4. Net Vol and Total Count 5. Buy and Sell Volume 6. Buy and Sell Count 7. Profit Factor   Thank you S.Khan  
free  05 Jul 2017
Hi, This indicator displays the Position info on the Chart over the Position Line.  Kind of visual.  (Courtesy : Charles Layton) Thank you. ///S.Khan    
free  05 Jul 2017
Hi, This Indicator basically displays : 1. Displays the PIPS (hourly, daily, weekly, monthly) and 2. Draw Lines through +/- ATR values on the CHART.   Have divided the ATR Value by x (x=1,2,3,4).   And converted it to Pips.  Added these Pips value to "OPEN PRICES" and drawn the lines on Chart. How to USE IT : 1.  Good for Trade :  If the Price has crossed  +D-1/2 ATR  or  -D-1/2 ATR, then it means that this PAIR is good for trading (either Buy or Sell. depending on your other triggers). 2.  Trigger :  After it has crossed Daily ATR lines, then wait for the prices to cross the "Hourly +ve or -ve" ATR line to start trading.  (Direction based on other trigger indicators).   3. Trending :  If Both Weekly ATR lines (+ve or -ve) are above Both the Monthly ATR Lines or vice versa. The Pair is trending. 4. Ranging :   if Daily lines are within Weekly ATR Lines,  and Weekly ATR Line are between the Monthly ATR lines. The Pair is ranging. 5. Short-Term Reversal :  if Price have broken all +ve (-ve)  Daily, Weekly, Monthly ATR lines in single session. *if it was early in ranging setup. 6. OPEN PRICES  :  if Daily Open Price is above Weekly Open Price, and Weekly Open Price is above Monthly Open Price  or vice versa ), then usually this Pair is also in trending mode but ranging setup (#4) will confirm or reject it. Disclaimer : This is not a Holy grail. Please use this for short-term inter-day trading.  And keep Take Profit as per 15-min ATR value in Pips. And keep Stop Loss outside 1-Hr ATR Line.  Leave your comments and feedback, so a cBOT can also be developed. Hope it helps other too who want to know how many Pips a Pair has moved from its opening price.   Please rate it and leave a comment. Thank you. ///S.Khan (*Still Learning to TRADE )  
free  05 Jul 2017
Hi, this indicator displays the Hourly, Daily, Weeky, Monthly Total Pips and ATR Value on Chart. Please rate it and leave a comment. Thank you. ///S.Khan    
Warning! Executing cBots downloaded from this section may result in loss of funds. Use them at your own risk.
SK1 - Moon Chaser - v1
  7
  0
  1302
paid  02 Dec 2019
Hi, made $100,000 Net Profit.  This compact Robot "Moon Chaser ver 1" to be used as template for further development.  Have backtested and optimized on GBP-AUD from 05-Jan-2015  to  28-June-2019 (3.5 years), Starting Capital USD 3K. TimeFrame 1Hr, Broker "FxPro".  You have to find your own optimized settings for different Brokers.  (example: for Broker = IC Market, you require Starting Capital greater than 15K for it to run on these default settings). Max Draw Down = USD 15K approx.  which means you need to have a minimum account size of 20K so it can handle trade easily. Since, the cBOT runs onBAR method and not onTICK so one can simply load the H1 bar data. Default Settings are good for this period.  You will have to find your own settings for different period and Broker. You can download it from here below (click on the link below): http://bit.ly/2XSBwPe Contact me on : skhan.projects@gmail.com  (if you have something important to share and new ideas) Leave your comment below and show your backtest results with settings for benefit of everyone. would like to charge USD 50 per month If you want to Run this on Live or Demo Account. It comes to USD 600 per year. Thank you ///SKhan   Statistics : Equity Graph:   Full Draw Down Values in USD
free  09 Nov 2017
  (revised : 09-Nov-2017) Hi, this cBot displays 28 Pairs under their MAJOR PAIR.   It shows which Pair is Volatile by comparing : the 1-min candle (user can change it), total Pips between High and Low    vs with  15-min (user can change it) ATR value (in pips). If a 1-min Pips Value is higher then the 15-min ATR.  It changes color and sounds the alarm.  You can turn "ON" the sound but it makes it very irritating. No need to change any user-input settings.   This cBOT is also like a template and can be used to display a lot of more information and can be easily converted into a TRADING cBOT.    Let me know if any other information you want to add; like Bollingerbands Signal on 1hr or 4 hr or show Spread also....    all can be done. Please leave your comments down below.  Thank you ///S.Khan  
free  05 Jul 2017
Hi All, This cBOT displays 8-Major Pairs strength in different Time Frames.  I have chosen 1-Hr, 4Hr, Daily, Weekly, Monthly. Plus, it also shows the average and the Previous Time Frame values also. In the Picture, have highlighted with red box : #1.  This is the average value in Pips, of 4-previous values i/c current one. This column is sorted as per the Sorting in the Current Col.  IF Highlighted then it means that the "total pips" value in "Current" column has crossed this avg. value. #2.  Compare the Total Pips in 4-Hr Time Frame, (previous) with the ATR Value. If highlighted, it means that the value has crossed the ATR value of that same Time frame. #3.  This is "AVERAGE" Column #4. This is the "Current" Column #5, 6, 7 : These are the Values of the previous Time Frames. #8: If anyone of the 8-Major Pair, Total Pips (Current Time Frame) was greater then Average Pips in all Time Frames, then it will record the date and time over here. #9:  Sum of all the 28Pairs Pips and sum of 8-Major ATR Values displayed in the Last row. #10: Average of the 28 Pairs.   How to USE : 1. Which Pairs to trade : Normally, the Major-Pair whose "TOTAL Pips" has crossed "600" value in "DAILY" Current Time Frame, is the Pair which has the most movement. Better to trade the sub-pairs of that Major Pair when it cross this value. 2. Reversal : if the current "Total Pip" has crossed the current "ATR" Value, in any Time Frame, then it is most likely set to reverse. The cBot, will highlight it. Greater the time frame, the greater the chance of reversal. if the "week time-frame" closes with Total Pips greater then ATR Value in Weekly Time Frame, then that Pair will reverse the following next week.  *Check the JPY Pair, in the Weekly Time Frame in Prev-1 column and its value now in Current Weekly Time Frame. 3: Not to trade Pairs : whose Major-Pair are next to each other in the "current" Daily and 4-hour Time-Frame.  Atleast, a distance of two pairs is good. If GBP-Pair and JPY-Pair are next to each other in the sorted list; then better not to trade GBPJPY as it will move sideways. NOTE : THE CODE PASTED HERE (AFTER THE IMAGE)  IS THE RIGHT CODE.  FOR SOME REASON, THIS WEBSITE WAS NOT LOADING THIS CODE FILE.  THE FILE UPLOADED, IS JUST A TEMP FILE; IGNORE THAT FILE.   Please leave a comment if you like it and share any idea you would like to add to this cBOT. Thank you ///S.Khan   //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// //// //// Name : INTER-MARKET CBOT //// //// Dated : 30-Mar-16 //// //// ver : 3.0 //// //// Updated : 30-Mar-16 //// //// //// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////// using System.Globalization; using System.IO; using System.Threading; using System; using System.Linq; using cAlgo.API; using cAlgo.API.Indicators; using cAlgo.API.Internals; using cAlgo.Indicators; namespace cAlgo { [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)] public class MajorPairStrengthv4 : Robot { ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// USER INPUT /////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// [Parameter("<--------------> FRIDAY <-------------->")] public string temp50 { get; set; } [Parameter("43. Close on Friday (yes or no)", DefaultValue = false)] public bool p_Flag_CloseFriday { get; set; } [Parameter("44. Close On Friday (x hours)", DefaultValue = 2, MinValue = 1, MaxValue = 10)] public int p_FridayClose_Hrs { get; set; } [Parameter("45. Write Data to CSV File ", DefaultValue = false)] public bool p_Flag_Create_CSV_File { get; set; } [Parameter("46. Folder Name on the Desktop ", DefaultValue = "SK Intermarket v4")] public string p_str_Folder_Name { get; set; } [Parameter("47. Live (No), BackTesting (Yes)", DefaultValue = false)] public bool p_Flag_BackTesting { get; set; } /////////////////////////////////// // END OF USER INPUT ///// /////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// GLOBAL VARIABLES /////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // #-------------- TIME FRAMES --------------# // 5-min TimeFrame TF_5min = TimeFrame.Minute5; // 15 min TimeFrame TF_15min = TimeFrame.Minute15; // 1 Hr TimeFrame TF_1Hr = TimeFrame.Hour; // 4 Hr TimeFrame TF_4Hr = TimeFrame.Hour4; // Daily TimeFrame TF_D = TimeFrame.Daily; // Weekly TimeFrame TF_Wk = TimeFrame.Weekly; // 1-Month TimeFrame TF_Mt = TimeFrame.Monthly; // "#-------------- ATR VALUES --------------#" // 5-MIN (covering 1 hour) int ATR_P_5min = 20; // 15-MIN (covering 2 hours) int ATR_P_15min = 20; // 1-HOUR (covering 3 hours) int ATR_P_1Hr = 20; // 4-HOUR (covering 12 hours) int ATR_P_4Hr = 20; // Daily-ATR (covering 5 days) int ATR_P_D = 20; // Weekly-ATR (covering 1 month) int ATR_P_Wk = 20; // Monthly (covering 4 months) int ATR_P_Mt = 20; MovingAverageType p_ATR_MA_Type = MovingAverageType.Simple; // ----------------------------------------------------------- // PREVIOUS PRICES : INDEX private int LP1 = 4; // CONTAINS THE INDEX VALUES TO ACCESS OPEN PRICES : Current, Last, 3Months, 6 months private int[] LP1_Array_Open; private int[] LP1_Array_Close; private string[] LP1_TF_Name; // DAY WEEK VALUE private int Day_of_the_Week_1 = 0; private int Day_of_the_Week_2 = 0; private int Month_of_the_Year = 0; private string[] Month_Name; private bool Flag_New_Day = true; private bool Flag_is_Monday_Next = false; //For Indexng of MarketSeries private int Count_Bar = 0; //private double Daily_Count_Bar = 0; // COLORS --------------------------------------------------------- private Colors Clr_Bk_1 = Colors.DimGray; private Colors Clr_Heading_1 = Colors.Yellow; private Colors Clr_PairListing = Colors.Aqua; private Colors Clr_Positive = Colors.LightGreen; private Colors Clr_Negative = Colors.MediumVioletRed; private Colors Clr_Above = Colors.CornflowerBlue; private Colors Clr_Below = Colors.WhiteSmoke; private Colors Clr_Border = Colors.LightGray; // ALL 28 PAIRS PRICES [28,3] DAILY WEEKLY MONTHLY ---------------- private double[] All_28Pair_Pip_Size; private string[] All_28Pair_Symbol_Code; // ------- ATR VALUES ----------------- private double[,,] All_28Pair_ATR_Value; private double[,] GTotal_28Pair_ATR_Value; private double[,,] All_MajorPair_ATR_Value; private double[,] GTotal_MajorPair_ATR_Value; // 8 MAJOR PAIRS : DAILY, WEEKLY, MONTHLY private string[] MajorPair_Headings; private string[,] MajorPair_Combo; private int[,] Base_Currency; // ------- CURRENT PRICES -------------------------------------- // ARRAYS FOR STORING PREVIOUS PRICES : OPEN, HIGH, LOW, CLOSE private double[,,] All_28Pair_Open_Price; private double[,,] All_28Pair_Close_Price; private double[,,] All_28Pair_HiLo_Price; private double[,,] All_28Pair_Total_Pips; private double[,,] All_MajorPair_Total_Pips; private double[,] GTotal_28Pair_Total_Pips; private double[,] GTotal_MajorPair_Total_Pips; private int[,] Sorted_MajorPair_Monthly_Total_Pips; private int[,] Sorted_MajorPair_Weekly_Total_Pips; private int[,] Sorted_MajorPair_Daily_Total_Pips; private int[,] Sorted_MajorPair_4Hour_Total_Pips; private int[,] Sorted_MajorPair_Hourly_Total_Pips; private int[,] Sorted_MajorPair_15min_Total_Pips; // ----------------------------------------------------------------- // ------- AVERAGE PIPS ---------------------------------------- private double[,] Avg_All_28Pair_Total_Pips; private double[,] Avg_All_MajorPair_Total_Pips; // KEEP TRACK OF 8-MAJOR PAIR, IF TOTAL PIPS HAVE // CROSSED AVG.PIPS, IN ALL 7 TIME FRAMES private int[] Flag_TotalPips_Greater_AvgPips; private string[] DateTime_TotalPips_Greater_AvgPips; // ATR INDICATOR INSTANCE ///////////////////// private AverageTrueRange ATR_Indicator_1; private AverageTrueRange ATR_Indicator_2; private AverageTrueRange ATR_Indicator_3; private AverageTrueRange ATR_Indicator_4; private AverageTrueRange ATR_Indicator_5; private AverageTrueRange ATR_Indicator_6; private AverageTrueRange ATR_Indicator_7; /////////////////////////////////////////////// // CSV FILE CREATION private static string str_DesktopFolder; private static string str_FolderPath; private static string str_FileName; private System.IO.FileStream File_Stream; private System.IO.StreamWriter File_Writer; //*Important : These File_Stream and File_Writer has to be closed On_Stop function. //see On_Stop function in the END //////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////// // END OF GLOBAL VARIABLES ///// /////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// ON START /////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected override void OnStart() { //DISPLAY START DATE AND TIME string t_Date = string.Format("{0:ddd-d-MMMM-y, HH:MM}", Server.Time); Print(""); Print("cBOT Start Date & Time : " + t_Date); // DISPLAY cBOT NAME ON CHART Draw_OnChart_C1("DBNAME01", (1), (1), "INTER-MARKET V4.0 BY /// S.KHAN (skhan.projects@gmail.com) ", Clr_Heading_1); //Set the Count Bar Value for MarketSeries Set_Count_Bar_Value(); if (p_Flag_Create_CSV_File) { Create_CSV_File(); } //END IF // DECLARE ALL ARRAYS ONCE ONLY ON START Declare_All_Arrays(); // INITIALIZE ARRAY ON START Initialize_Array_OnStart_Only(); //WRITE FIXED VALUE ON CHART SCREEN Create_Fixed_Display_1(); Create_Fixed_Display_2(); Create_Display_RowColumn(); // START LINE, STOP LINE, COL # Display_Vertical_Lines(3, 75, 9); Display_Vertical_Lines(3, 75, 24); // LINE NO, START COL, STOP COL Display_Horizontal_Lines(30, 1, 24); Display_Horizontal_Lines(43, 1, 24); // LOAD SYMBOL CODE AND PIPS SIZE Load_28Pair_SymbolCode(); Load_28Pair_PipSize(); // LOAD ON START-ONLY : OPEN PRICES OF ALL TIME FRAME OnSTART_Load_28Pair_Open_Prices(); // CURRENT PRICES --------------------------------------- Load_28Pair_Open_Prices(); Load_28Pair_Close_Prices(); // CALCULATE 28-PAIRS - TOTAL PIPS Get_28Pair_TOTAL_Pips_from_Open(); // GET 8-MAJOR PAIR - TOTAL PIPS Get_MajorPair_Total_Pips(); // ATR VALUES ------------------------------------------- Load_28Pair_ATR_Values(); Get_MajorPair_ATR_Values(); //Write_CSVFIle_MajorPair_Monthly_Total_Pips(); } //End METHOD On_Start ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// ON B A R /////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected override void OnBar() { //Print("OnBar'' MEHTOD START : D/T= " + Server.Time); //SET THE DAY OF WEEK VALUE MON=1, TUE=2, ........FRI=5 Day_of_the_Week_1 = (int)Server.Time.DayOfWeek; // GET THE MONTH OF THE YEAR Month_of_the_Year = (int)Server.Time.Month; //CHECK CHANGE OF DAY if (Day_of_the_Week_1 != Day_of_the_Week_2) Flag_New_Day = true; else Flag_New_Day = false; //IF NEW DAY THEN GET NEW VALUES if (Flag_New_Day == true) { Flag_New_Day = false; } //END IF // CURRENT PRICES ------------------------------------------------- Load_28Pair_Open_Prices(); Load_28Pair_Close_Prices(); Load_28Pair_ATR_Values(); // Get TOTAL PIPS Get_28Pair_TOTAL_Pips_from_Open(); Get_MajorPair_Total_Pips(); Get_MajorPair_ATR_Values(); // AVERAGE Get_Avg_28Pair_Total_Pips(); Get_Avg_MajorPair_Total_Pips(); // SORT Sort_MajorPair_15min_TotalPips_Array(); Sort_MajorPair_Hourly_TotalPips_Array(); Sort_MajorPair_4Hour_TotalPips_Array(); Sort_MajorPair_Daily_TotalPips_Array(); Sort_MajorPair_Weekly_TotalPips_Array(); Sort_MajorPair_Monthly_TotalPips_Array(); // ----------------------------------------------------------------- // DISPLAY -------------------------------------------------------- int t_Line = 5, t_Col = 1; //Display_MajorPair_15min_Total_Pips(t_Line, t_Col); Display_MajorPair_Hourly_Total_Pips(t_Line, t_Col); Display_MajorPair_4Hour_Total_Pips(t_Line + 14, t_Col); Display_MajorPair_Daily_Total_Pips(t_Line + 28, t_Col); Display_MajorPair_Weekly_Total_Pips(t_Line + 42, t_Col); Display_MajorPair_Monthly_Total_Pips(t_Line + 56, t_Col); // ----------------------------------------------------------------- // IF TOTAL PIP > AVERAGE PIP IN ALL TIME FRAME -------------------- Update_Array_AvgPips_Greater_then_TotalPips(); Display_Array_AvgPips_Greater_then_TotalPips(61, 26); // ----------------------------------------------------------------- //MAKE A COPY OF THE DAY TO BE COMPARED, ON THE NEXT BAR Day_of_the_Week_2 = Day_of_the_Week_1; //IF FRIDAY THEN RESET THE MONDAY FLAG if (Day_of_the_Week_1 == 5) Flag_is_Monday_Next = true; // IF DAY HAS CHANGED TO MONDAY FROM SUNDAY OR FRIDAY if (Flag_is_Monday_Next == true && Day_of_the_Week_1 == 1) { Flag_is_Monday_Next = false; } //END IF } //END METHOD On_Bar ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// ON T I C K /////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected override void OnTick() { // Put your core logic here } //End METHOD On_TICK ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// TEST_FUNCTION /////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void TEST_FUNCTION() { } //END MEHTOD TEST_FUNCTION ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// Display_Array_AvgPips_Greater_then_TotalPips /////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void Display_Array_AvgPips_Greater_then_TotalPips(int t_Row, int t_Col) { int t_Line_no = 0, t_Col_no = 0, t_Offset = 0; double t_1 = 0; string tstr_1, tstr_Symbol_Code, tstr_Date, temp_1; Colors t_Clr; // SET THE LINE # AND COLUMN # t_Line_no = t_Row; t_Col_no = t_Col; t_Offset = 2; // DISPLAY AVERAGE VALUES --------------------------------------------------------------------------------- // COLUMN HEADINGs Draw_OnChart_C1("AvgTPips01", (t_Line_no - 2), (t_Col_no), "TOTAL > AVG.PIP", Clr_Heading_1); Draw_OnChart_C1("AvgTPips02", (t_Line_no - 1), (t_Col_no), "MAJOR PAIR", Clr_Heading_1); Draw_OnChart_C1("AvgTPips03", (t_Line_no - 2), (t_Col_no + t_Offset), " ALL", Clr_Heading_1); Draw_OnChart_C1("AvgTPips04", (t_Line_no - 1), (t_Col_no + t_Offset), "TIMEFRAME", Clr_Heading_1); //LOOP TO DISPLAY AVERAGE VALUES for (int i = 0; i < 8; i++) { // CONVERT t_Last_Price to STRING FOR UNIQUE OBJECT NAME IN Draw_OnChart_C1 METHOD temp_1 = i.ToString(); // GET SYMBOL CODE tstr_Symbol_Code = i.ToString("0") + ". " + MajorPair_Headings[i]; // GET THE VALUES FROM ARRAY t_1 = Flag_TotalPips_Greater_AvgPips[i]; tstr_Date = DateTime_TotalPips_Greater_AvgPips[i]; if (t_1 >= 5) { tstr_1 = "YES"; } else { tstr_1 = "NO"; } //END IF ELSE // SET COLOR NAME ON POSITIVE OR NEGATIVE TOTAL PIP FROM OPEN if (tstr_1 == "YES") t_Clr = Clr_Above; else t_Clr = Clr_Below; // DRAW ON CHART(OBJ_NAME, LINE#, COL#, Text_To_Display, ColorName); Draw_OnChart_C1("AVGTPips05" + temp_1, t_Line_no, (t_Col_no), tstr_Symbol_Code, Clr_PairListing); Draw_OnChart_C1("AVGTPips06" + temp_1, t_Line_no, (t_Col_no + t_Offset), tstr_1, t_Clr); if (tstr_1 == "YES") { Draw_OnChart_C1("AVGTPips07" + temp_1, t_Line_no, (t_Col_no + t_Offset + 1), tstr_Date, t_Clr); } else { Draw_OnChart_C1("AVGTPips07" + temp_1, t_Line_no, (t_Col_no + t_Offset + 1), "(Prev.Date) = " + tstr_Date, t_Clr); } //END IF ELSE // INC. THE LINE # t_Line_no += 1; // LEAVE A BLANK LINE if (i == 3) t_Line_no += 1; } //END FOR i } //END MEHTOD Display_Array_AvgPips_Greater_then_TotalPips ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// Update_Array_AvgPips_Greater_then_TotalPips /////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void Update_Array_AvgPips_Greater_then_TotalPips() { double t_1 = 0, t_2 = 0; int t_Count = 0; string t_Text; // FOR 8-MAJOR PAIRS for (int i = 0; i < 8; i++) { // 7-TIME FRAME : 0=5min, 1=15min, 2=1Hour, 3=4Hr, 5=Daily, 6=Weekly, 7=Monthly for (int j = 2; j < 7; j++) { // TOTAL PIPS OF MAJOR PAIR : 1ST INDEX IS FOR CURRENT or // Previous Values, 2nd index is for MAJOR-PAIR, t_TF can be 5min, Daily, Monthly t_1 = Math.Abs(All_MajorPair_Total_Pips[0, i, j]); t_2 = Avg_All_MajorPair_Total_Pips[i, j]; if (t_1 >= t_2) t_Count += 1; } //END FOR j // IF TOTALPIPS IN THE PARTICULAR TIME FRAME HAS CROSSED ITS // AVG. PIPS IN THE SAME TIME FRAME if (t_Count >= 5) { // SET THE FLAG TO TRUE Flag_TotalPips_Greater_AvgPips[i] = 1; // STORE THE DATE TIME t_Text = string.Format("{0:ddd-d-MMM-y, HH:mm}", Server.Time); DateTime_TotalPips_Greater_AvgPips[i] = t_Text; } else { Flag_TotalPips_Greater_AvgPips[i] = 0; } //END IF ELSE //RESET THE COUNTER t_Count = 0; } //END FOR i } //END MEHTOD Update_Array_AvgPips_Greater_then_TotalPips ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// Get_Avg_28Pair_Total_Pips /////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void Get_Avg_28Pair_Total_Pips() { double t_1 = 0; //Print("INSIDE : AVERAGE - MAJOR PAIRS"); // LOOP FOR 8-MAJOR PAIRS for (int i = 0; i < 8; i++) { // LOOP FOR 7-TIME FRAME for (int j = 0; j < 7; j++) { // LOOP FOR PREVIOUS PRICES DATA for (int k = 0; k < LP1; k++) { // CONVERT TO POSITIVE VALUES AND THEN ADD if (All_28Pair_Total_Pips[k, i, j] >= 0) t_1 += All_28Pair_Total_Pips[k, i, j]; else t_1 += All_28Pair_Total_Pips[k, i, j] * -1; } //END FOR K // FOR AVERAGE DIVIDE BY THE NO OF PREVIOUS PRICES ADDED Avg_All_28Pair_Total_Pips[i, j] = Math.Round(t_1 / LP1, 0); // RESET THE TOTAL TO 0 t_1 = 0; } //END FOR J } //END FOR I } //END MEHTOD Get_Avg_28Pair_Total_Pips ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// Get_Avg_MajorPair_Total_Pips /////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void Get_Avg_MajorPair_Total_Pips() { double t_1 = 0; // LOOP FOR 8-MAJOR PAIRS for (int i = 0; i < 8; i++) { // LOOP FOR 7-TIME FRAME for (int j = 0; j < 7; j++) { // LOOP FOR PREVIOUS PRICES DATA for (int k = 0; k < LP1; k++) { // CONVERT TO POSITIVE VALUES AND THEN ADD if (All_MajorPair_Total_Pips[k, i, j] >= 0) t_1 += All_MajorPair_Total_Pips[k, i, j]; else t_1 += All_MajorPair_Total_Pips[k, i, j] * -1; } //END FOR K // FOR AVERAGE DIVIDE BY THE NO OF PREVIOUS PRICES ADDED Avg_All_MajorPair_Total_Pips[i, j] = Math.Round(t_1 / LP1, 0); // RESET THE TOTAL TO 0 t_1 = 0; } //END FOR J } //END FOR I } //END MEHTOD Get_Avg_MajorPair_Total_Pips ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// Write_CSVFIle__MajorPair_Monthly_Total_Pips /////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void Write_CSVFIle_MajorPair_Monthly_Total_Pips() { int t_TF; double t_Total_Pip = 0; string tstr_TPips, tstr_Symbol_Code, tstr_CompleteRow; //SET TIME FRAME 0=5MIN, 1=15MIN, 2=1HR, 3=4HR, 4=D, 5=W, 6=M. t_TF = 6; // LOOP FOR 8 MAJOR-PAIRS : DISPLAY SYMBOL CODE AND TOTAL PIPS ON CHART for (int i = 0; i < 8; i++) { // GET THE SYMBOL INDEX FROM THE SORTED TEMP ARRAY //t_1 = Sorted_MajorPair_Monthly_Total_Pips[b, i]; // GET SYMBOL CODE AS PER THE t_Index tstr_Symbol_Code = MajorPair_Headings[i]; tstr_CompleteRow = tstr_Symbol_Code + ","; // LOOP TO ACCESS PREVIOUS PRICES for (int b = 0; b < LP1; b++) { // GET WEEKLY TOTAL PIPS MOVED FROM OPEN AND CONVERT TO STRING t_Total_Pip = All_MajorPair_Total_Pips[b, i, t_TF]; tstr_TPips = t_Total_Pip.ToString("0"); // ADD TO STRING ALL PREVIOUS PRICES OF ONE MAJOR PAIR ONLY tstr_CompleteRow += tstr_TPips + ","; } //END FOR b // WRITE MAJOR PARI : POSITION, SYMBOL CODE, TOTAL PIPS //WRITE CURRENT DATA File_Writer.WriteLine(Concate_With_Comma(tstr_CompleteRow)); // RESET THE STRING TO BLANK tstr_CompleteRow = ""; } // END FOR i } //END MEHTOD Write_CSVFIle__MajorPair_Monthly_Total_Pips ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// Return_Pair_Index_Position /////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private int Return_Pair_Index_Position(string tstr_Pair) { int t_index = 0; bool t_Flag = true; Symbol t_Symbol; while (t_Flag == true) { t_Symbol = Get_28Pair_Symbol(t_index); if (tstr_Pair == t_Symbol.Code.ToString()) { t_Flag = false; } //END IF t_index += 1; // IF PAIR IS NOT MATCHED : BREAK THE WHILE LOOP if (t_index >= 30) t_Flag = false; } //END WHILE // GO ONE BACK AS THE WHILE LOOPS ADD ONE EXTRA ON EXIT t_index -= 1; return t_index; } //END MEHTOD Return_Pair_Index_Position ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// Return_Name_of_the_Month /////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private string Return_Name_of_the_Month(int t_Month) { string t_str1 = ""; // IF NEGATIVE NUMBER e.g. -1, it means Dec of the PREVIOUS YEAR if (t_Month < 0) t_Month += 13; t_str1 = Month_Name[t_Month]; return t_str1; } //END MEHTOD Return_Name_of_the_Month ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// Sort_MajorPair_15min_TotalPips_Array /////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void Sort_MajorPair_15min_TotalPips_Array() { int t_1 = 0; int t_TF; double t_2 = 0; // TEMP ARRAY FOR STORING INDEX VALUE AND ARRAY VALUE int[] t_Index; double[] t_Value; t_Index = new int[8]; t_Value = new double[8]; //SET TIME FRAME 0=5MIN, 1=15MIN, 2=1HR, 3=4HR, 4=D, 5=W, 6=M. t_TF = 1; // LOOP TO DISPLAY LAST 4 VALUES for (int b = 0; b < LP1; b++) { //LOOP FOR 8-MAJOR PAIRS : COPY VALUES for (int i = 0; i < 8; i++) { // COPY IN TEMP ARRAY : serial#, Pip value t_Index[i] = i; t_Value[i] = All_MajorPair_Total_Pips[b, i, t_TF]; } //END FOR // SORT THE TEMP ARRAY INTO DESCENDING ORDER bool change = true; while (change == true) { change = false; // COMPARE VALUES [LOOP WILL RUN ONE LESS] for (int i = 0; i < 7; i++) { if (t_Value[i] < t_Value[i + 1]) { change = true; //SWAP FIRST INDEX VALUES (COUNTER) OF THE TEMP ARRAY t_1 = t_Index[i + 1]; t_Index[i + 1] = t_Index[i]; t_Index[i] = t_1; //SWAP 2ND INDEX VALUES (TOTAL PIP) OF THE TEMP ARRAY t_2 = t_Value[i + 1]; t_Value[i + 1] = t_Value[i]; t_Value[i] = t_2; } //END IF } //END FOR } //END WHILE SORTING //LOOP FOR 8-MAJOR PAIRS : COPY FROM TEMP ARRAY TO SORTED ARRAY for (int i = 0; i < 8; i++) { Sorted_MajorPair_15min_Total_Pips[b, i] = t_Index[i]; } // END FOR } // END FOR B } //END METHOD Sort_MajorPair_15min_TotalPips_Array ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// Sort_MajorPair_Hourly_TotalPips_Array /////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void Sort_MajorPair_Hourly_TotalPips_Array() { int t_1 = 0; int t_TF; double t_2 = 0; // TEMP ARRAY FOR STORING INDEX VALUE AND ARRAY VALUE int[] t_Index; double[] t_Value; t_Index = new int[8]; t_Value = new double[8]; //SET TIME FRAME 0=5MIN, 1=15MIN, 2=1HR, 3=4HR, 4=D, 5=W, 6=M. t_TF = 2; // LOOP TO DISPLAY LAST 4 VALUES for (int b = 0; b < LP1; b++) { //LOOP FOR 8-MAJOR PAIRS : COPY VALUES for (int i = 0; i < 8; i++) { // COPY IN TEMP ARRAY : serial#, Pip value t_Index[i] = i; t_Value[i] = All_MajorPair_Total_Pips[b, i, t_TF]; } //END FOR // SORT THE TEMP ARRAY INTO DESCENDING ORDER bool change = true; while (change == true) { change = false; // COMPARE VALUES [LOOP WILL RUN ONE LESS] for (int i = 0; i < 7; i++) { if (t_Value[i] < t_Value[i + 1]) { change = true; //SWAP FIRST INDEX VALUES (COUNTER) OF THE TEMP ARRAY t_1 = t_Index[i + 1]; t_Index[i + 1] = t_Index[i]; t_Index[i] = t_1; //SWAP 2ND INDEX VALUES (TOTAL PIP) OF THE TEMP ARRAY t_2 = t_Value[i + 1]; t_Value[i + 1] = t_Value[i]; t_Value[i] = t_2; } //END IF } //END FOR } //END WHILE SORTING //LOOP FOR 8-MAJOR PAIRS : COPY FROM TEMP ARRAY TO SORTED ARRAY for (int i = 0; i < 8; i++) { Sorted_MajorPair_Hourly_Total_Pips[b, i] = t_Index[i]; } // END FOR } // END FOR B } //END METHOD Sort_MajorPair_Hourly_TotalPips_Array ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// Sort_MajorPair_4Hour_TotalPips_Array /////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void Sort_MajorPair_4Hour_TotalPips_Array() { int t_1 = 0; int t_TF; double t_2 = 0; // TEMP ARRAY FOR STORING INDEX VALUE AND ARRAY VALUE int[] t_Index; double[] t_Value; t_Index = new int[8]; t_Value = new double[8]; //SET TIME FRAME 0=5MIN, 1=15MIN, 2=1HR, 3=4HR, 4=D, 5=W, 6=M. t_TF = 3; // LOOP TO DISPLAY LAST 4 VALUES for (int b = 0; b < LP1; b++) { //LOOP FOR 8-MAJOR PAIRS : COPY VALUES for (int i = 0; i < 8; i++) { // COPY IN TEMP ARRAY : serial#, Pip value t_Index[i] = i; t_Value[i] = All_MajorPair_Total_Pips[b, i, t_TF]; } //END FOR // SORT THE TEMP ARRAY INTO DESCENDING ORDER bool change = true; while (change == true) { change = false; // COMPARE VALUES [LOOP WILL RUN ONE LESS] for (int i = 0; i < 7; i++) { if (t_Value[i] < t_Value[i + 1]) { change = true; //SWAP FIRST INDEX VALUES (COUNTER) OF THE TEMP ARRAY t_1 = t_Index[i + 1]; t_Index[i + 1] = t_Index[i]; t_Index[i] = t_1; //SWAP 2ND INDEX VALUES (TOTAL PIP) OF THE TEMP ARRAY t_2 = t_Value[i + 1]; t_Value[i + 1] = t_Value[i]; t_Value[i] = t_2; } //END IF } //END FOR } //END WHILE SORTING //LOOP FOR 8-MAJOR PAIRS : COPY FROM TEMP ARRAY TO SORTED ARRAY for (int i = 0; i < 8; i++) { Sorted_MajorPair_4Hour_Total_Pips[b, i] = t_Index[i]; } // END FOR } // END FOR B } //END METHOD Sort_MajorPair_4Hour_TotalPips_Array ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// Sort_MajorPair_Daily_TotalPips_Array /////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void Sort_MajorPair_Daily_TotalPips_Array() { int t_1 = 0; int t_TF; double t_2 = 0; // TEMP ARRAY FOR STORING INDEX VALUE AND ARRAY VALUE int[] t_Index; double[] t_Value; t_Index = new int[8]; t_Value = new double[8]; //SET TIME FRAME 0=5MIN, 1=15MIN, 2=1HR, 3=4HR, 4=D, 5=W, 6=M. t_TF = 4; // LOOP TO DISPLAY LAST 4 VALUES for (int b = 0; b < LP1; b++) { //LOOP FOR 8-MAJOR PAIRS : COPY VALUES for (int i = 0; i < 8; i++) { // COPY IN TEMP ARRAY : serial#, Pip value t_Index[i] = i; t_Value[i] = All_MajorPair_Total_Pips[b, i, t_TF]; } //END FOR // SORT THE TEMP ARRAY INTO DESCENDING ORDER bool change = true; while (change == true) { change = false; // COMPARE VALUES [LOOP WILL RUN ONE LESS] for (int i = 0; i < 7; i++) { if (t_Value[i] < t_Value[i + 1]) { change = true; //SWAP FIRST INDEX VALUES (COUNTER) OF THE TEMP ARRAY t_1 = t_Index[i + 1]; t_Index[i + 1] = t_Index[i]; t_Index[i] = t_1; //SWAP 2ND INDEX VALUES (TOTAL PIP) OF THE TEMP ARRAY t_2 = t_Value[i + 1]; t_Value[i + 1] = t_Value[i]; t_Value[i] = t_2; } //END IF } //END FOR } //END WHILE SORTING //LOOP FOR 8-MAJOR PAIRS : COPY FROM TEMP ARRAY TO SORTED ARRAY for (int i = 0; i < 8; i++) { Sorted_MajorPair_Daily_Total_Pips[b, i] = t_Index[i]; } // END FOR } // END FOR B } //END METHOD Sort_MajorPair_Daily_TotalPips_Array ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// Sort_MajorPair_Weekly_TotalPips_Array /////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void Sort_MajorPair_Weekly_TotalPips_Array() { int t_1 = 0; int t_TF; double t_2 = 0; // TEMP ARRAY FOR STORING INDEX VALUE AND ARRAY VALUE int[] t_Index; double[] t_Value; t_Index = new int[8]; t_Value = new double[8]; //SET TIME FRAME 0=5MIN, 1=15MIN, 2=1HR, 3=4HR, 4=D, 5=W, 6=M. t_TF = 5; // LOOP TO DISPLAY LAST 4 VALUES for (int b = 0; b < LP1; b++) { //LOOP FOR 8-MAJOR PAIRS : COPY VALUES for (int i = 0; i < 8; i++) { // COPY IN TEMP ARRAY : serial#, Pip value t_Index[i] = i; t_Value[i] = All_MajorPair_Total_Pips[b, i, t_TF]; } //END FOR // SORT THE TEMP ARRAY INTO DESCENDING ORDER bool change = true; while (change == true) { change = false; // COMPARE VALUES [LOOP WILL RUN ONE LESS] for (int i = 0; i < 7; i++) { if (t_Value[i] < t_Value[i + 1]) { change = true; //SWAP FIRST INDEX VALUES (COUNTER) OF THE TEMP ARRAY t_1 = t_Index[i + 1]; t_Index[i + 1] = t_Index[i]; t_Index[i] = t_1; //SWAP 2ND INDEX VALUES (TOTAL PIP) OF THE TEMP ARRAY t_2 = t_Value[i + 1]; t_Value[i + 1] = t_Value[i]; t_Value[i] = t_2; } //END IF } //END FOR } //END WHILE SORTING //LOOP FOR 8-MAJOR PAIRS : COPY FROM TEMP ARRAY TO SORTED ARRAY for (int i = 0; i < 8; i++) { Sorted_MajorPair_Weekly_Total_Pips[b, i] = t_Index[i]; } // END FOR } // END FOR B } //END METHOD Sort_MajorPair_Weekly_TotalPips_Array ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// Sort_MajorPair_Monthly_TotalPips_Array /////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void Sort_MajorPair_Monthly_TotalPips_Array() { int t_1 = 0; int t_TF; double t_2 = 0; // TEMP ARRAY FOR STORING INDEX VALUE AND ARRAY VALUE int[] t_Index; double[] t_Value; t_Index = new int[8]; t_Value = new double[8]; //SET TIME FRAME 0=5MIN, 1=15MIN, 2=1HR, 3=4HR, 4=D, 5=W, 6=M. t_TF = 6; // LOOP TO DISPLAY LAST 4 VALUES for (int b = 0; b < LP1; b++) { //LOOP FOR 8-MAJOR PAIRS : COPY VALUES for (int i = 0; i < 8; i++) { // COPY IN TEMP ARRAY : serial#, Pip value t_Index[i] = i; t_Value[i] = All_MajorPair_Total_Pips[b, i, t_TF]; } //END FOR // SORT THE TEMP ARRAY INTO DESCENDING ORDER bool change = true; while (change == true) { change = false; // COMPARE VALUES [LOOP WILL RUN ONE LESS] for (int i = 0; i < 7; i++) { if (t_Value[i] < t_Value[i + 1]) { change = true; //SWAP FIRST INDEX VALUES (COUNTER) OF THE TEMP ARRAY t_1 = t_Index[i + 1]; t_Index[i + 1] = t_Index[i]; t_Index[i] = t_1; //SWAP 2ND INDEX VALUES (TOTAL PIP) OF THE TEMP ARRAY t_2 = t_Value[i + 1]; t_Value[i + 1] = t_Value[i]; t_Value[i] = t_2; } //END IF } //END FOR } //END WHILE SORTING //LOOP FOR 8-MAJOR PAIRS : COPY FROM TEMP ARRAY TO SORTED ARRAY for (int i = 0; i < 8; i++) { Sorted_MajorPair_Monthly_Total_Pips[b, i] = t_Index[i]; } // END FOR } // END FOR B } //END METHOD Sort_MajorPair_Monthly_TotalPips_Array ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// Display_MajorPair_15min_Total_Pips /////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void Display_MajorPair_15min_Total_Pips(int t_Row, int t_Col) { int t_Line_no = 0, t_Col_no = 0, t_Offset = 0, t_1 = 0; double t_Total_Pip = 0, t_2 = 0; double t_ATR; int t_TF; string tstr_TPips, tstr_Symbol_Code, temp_1, tstr_TFrame, tstr_GrandTotal, tstr_ATR; Colors t_Clr; //SET TIME FRAME 0=5MIN, 1=15MIN, 2=1HR, 3=4HR, 4=D, 5=W, 6=M. t_TF = 1; // SET THE LINE # AND COLUMN # t_Line_no = t_Row; t_Col_no = t_Col; t_Offset = 2; // DISPLAY AVERAGE VALUES --------------------------------------------------------------------------------- // COLUMN HEADINGs Draw_OnChart_C1("AvgPips01", (t_Line_no - 2), (t_Col_no), "AVERAGE", Clr_Heading_1); Draw_OnChart_C1("AvgPips02", (t_Line_no - 1), (t_Col_no), "MAJOR PAIR", Clr_Heading_1); Draw_OnChart_C1("AvgPips03", (t_Line_no - 2), (t_Col_no + t_Offset), "15-min", Clr_Heading_1); Draw_OnChart_C1("AvgPips04", (t_Line_no - 1), (t_Col_no + t_Offset), "AVG-Pips", Clr_Heading_1); //LOOP TO DISPLAY AVERAGE VALUES for (int i = 0; i < 8; i++) { // CONVERT t_Last_Price to STRING FOR UNIQUE OBJECT NAME IN Draw_OnChart_C1 METHOD temp_1 = i.ToString(); // SORT AS PER THE CURRENT SORTED MAJOR PAIR VALUES t_1 = Sorted_MajorPair_15min_Total_Pips[0, i]; // GET SYMBOL CODE AS PER THE t_Index tstr_Symbol_Code = i.ToString("0") + ". " + MajorPair_Headings[t_1]; // GET WEEKLY TOTAL PIPS MOVED FROM OPEN AND CONVERT TO STRING t_Total_Pip = Avg_All_MajorPair_Total_Pips[t_1, t_TF]; tstr_TPips = t_Total_Pip.ToString("0"); // GET TOTAL PIP FOR COMPARISON WITH AVERAGE TO SET THE COLOR t_2 = Math.Abs(All_MajorPair_Total_Pips[0, t_1, t_TF]); // SET COLOR NAME ON POSITIVE OR NEGATIVE TOTAL PIP FROM OPEN if (t_2 >= t_Total_Pip) t_Clr = Clr_Above; else t_Clr = Clr_Below; // DRAW ON CHART(OBJ_NAME, LINE#, COL#, Text_To_Display, ColorName); Draw_OnChart_C1("AVGPips05" + temp_1, t_Line_no, (t_Col_no), tstr_Symbol_Code, Clr_PairListing); Draw_OnChart_C1("AVGPips06" + temp_1, t_Line_no, (t_Col_no + t_Offset), tstr_TPips, t_Clr); // INC. THE LINE # t_Line_no += 1; // LEAVE A BLANK LINE if (i == 3) t_Line_no += 1; } //END FOR I // DISPLAY : AVERAGE OF 28 PAIRS TOTAL PIPS : CURRENT MONTH if (GTotal_28Pair_Total_Pips[0, t_TF] >= 0) t_Clr = Clr_Positive; else t_Clr = Clr_Negative; tstr_GrandTotal = (GTotal_28Pair_Total_Pips[0, t_TF] / 28).ToString("0"); Draw_OnChart_C1("AvgPips07", t_Line_no, (t_Col_no), "Avg of 28-Pairs", t_Clr); Draw_OnChart_C1("AvgPips08", t_Line_no, (t_Col_no + t_Offset), tstr_GrandTotal, t_Clr); // DISPLAY TOTAL PIPS --------------------------------------------------------------------------------- // RESET ROW COL POSITION TO DISPLAY THE NEXT LOOP VALUES t_Line_no = t_Row; t_Col_no = t_Col_no + 4; // LOOP TO DISPLAY LAST x VALUES for (int l = 0; l < LP1; l++) { // CONVERT t_Last_Price to STRING FOR UNIQUE OBJECT NAME IN Draw_OnChart_C1 METHOD temp_1 = l.ToString(); // GET THE TIME FRAME NAME tstr_TFrame = LP1_TF_Name[l]; // COLUMN HEADINGs Draw_OnChart_C1("PrvMPips01" + temp_1, (t_Line_no - 2), (t_Col_no), tstr_TFrame, Clr_Heading_1); Draw_OnChart_C1("PrvMPips02" + temp_1, (t_Line_no - 1), (t_Col_no), "MAJOR PAIR", Clr_Heading_1); Draw_OnChart_C1("PrvPMPips03" + temp_1, (t_Line_no - 2), (t_Col_no + t_Offset), "15-min", Clr_Heading_1); Draw_OnChart_C1("PrvPMPips04" + temp_1, (t_Line_no - 1), (t_Col_no + t_Offset), "T-Pips", Clr_Heading_1); Draw_OnChart_C1("PrvPMPips05" + temp_1, (t_Line_no - 2), (t_Col_no + t_Offset + 1), "15-min", Clr_Heading_1); Draw_OnChart_C1("PrvPMPips06" + temp_1, (t_Line_no - 1), (t_Col_no + t_Offset + 1), "ATR", Clr_Heading_1); // LOOP FOR 8 MAJOR-PAIRS : DISPLAY SYMBOL CODE AND TOTAL PIPS ON CHART for (int i = 0; i < 8; i++) { // GET THE SYMBOL INDEX FROM THE SORTED TEMP ARRAY t_1 = Sorted_MajorPair_15min_Total_Pips[l, i]; // GET SYMBOL CODE AS PER THE t_Index tstr_Symbol_Code = i.ToString("0") + ". " + MajorPair_Headings[t_1]; // GET WEEKLY TOTAL PIPS MOVED FROM OPEN AND CONVERT TO STRING t_Total_Pip = All_MajorPair_Total_Pips[l, t_1, t_TF]; tstr_TPips = t_Total_Pip.ToString("0"); // GET ATR VALUE t_ATR = All_MajorPair_ATR_Value[l, t_1, t_TF]; tstr_ATR = t_ATR.ToString(); // SET COLOR NAME ON POSITIVE OR NEGATIVE TOTAL PIP FROM OPEN if (t_Total_Pip >= 0) t_Clr = Clr_Positive; else t_Clr = Clr_Negative; // SET COLOR NAME ON POSITIVE OR NEGATIVE TOTAL PIP FROM OPEN if (t_Total_Pip >= t_ATR) t_Clr = Clr_Above; // DRAW ON CHART(OBJ_NAME, LINE#, COL#, Text_To_Display, ColorName); Draw_OnChart_C1("PrvMPips07" + temp_1, t_Line_no, (t_Col_no), tstr_Symbol_Code, Clr_PairListing); Draw_OnChart_C1("PrvMPips08" + temp_1, t_Line_no, (t_Col_no + t_Offset), tstr_TPips, t_Clr); // SET COLOR NAME ON POSITIVE OR NEGATIVE TOTAL PIP FROM OPEN if (t_Total_Pip >= 0) t_Clr = Clr_Positive; else t_Clr = Clr_Negative; // DRAW ATR VALUES ON CHART Draw_OnChart_C1("PrvMPips10" + temp_1, t_Line_no, (t_Col_no + t_Offset + 1), tstr_ATR, t_Clr); // INC. THE LINE # t_Line_no += 1; // LEAVE A BLANK LINE if (i == 3) t_Line_no += 1; } //END FOR I // ---------------------------------------------------------------------------------------------------------- // ON THE LAST LINE DISPLAY THE GRAND TOTAL OF ALL 28PAIRS : DAILY // SET COLOR NAME ON POSITIVE OR NEGATIVE TOTAL PIP FROM OPEN if (GTotal_28Pair_Total_Pips[l, t_TF] >= 0) t_Clr = Clr_Positive; else t_Clr = Clr_Negative; // DISPLAY GRAND_TOTAL OF TOTAL_DAILY_PIPS tstr_GrandTotal = GTotal_28Pair_Total_Pips[l, t_TF].ToString("0"); tstr_ATR = GTotal_28Pair_ATR_Value[l, t_TF].ToString(""); Draw_OnChart_C1("PrvMPips11" + temp_1, t_Line_no, (t_Col_no), "Total 28-Pairs", t_Clr); Draw_OnChart_C1("PrvMPips12" + temp_1, t_Line_no, (t_Col_no + t_Offset), tstr_GrandTotal, t_Clr); Draw_OnChart_C1("PrvMPips13" + temp_1, t_Line_no, (t_Col_no + t_Offset + 1), tstr_ATR, t_Clr); // INCREASE THE LINE SPACE FOR NEXT SET OF TIMEFRAME VALUES t_Line_no = t_Row; t_Col_no = t_Col_no + 5; } // END FOR L } //END MEHTOD Display_MajorPair_15min_Total_Pips ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// Display_MajorPair_Hourly_Total_Pips /////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void Display_MajorPair_Hourly_Total_Pips(int t_Row, int t_Col) { int t_Line_no = 0, t_Col_no = 0, t_Offset = 0, t_1 = 0; double t_Total_Pip = 0, t_2 = 0; double t_ATR; int t_TF; string tstr_TPips, tstr_Symbol_Code, temp_1, tstr_TFrame, tstr_GrandTotal, tstr_ATR; Colors t_Clr; //SET TIME FRAME 0=5MIN, 1=15MIN, 2=1HR, 3=4HR, 4=D, 5=W, 6=M. t_TF = 2; // SET THE LINE # AND COLUMN # t_Line_no = t_Row; t_Col_no = t_Col; t_Offset = 2; // DISPLAY AVERAGE VALUES --------------------------------------------------------------------------------- // COLUMN HEADINGs Draw_OnChart_C1("AvgPips01", (t_Line_no - 2), (t_Col_no), "AVERAGE", Clr_Heading_1); Draw_OnChart_C1("AvgPips02", (t_Line_no - 1), (t_Col_no), "MAJOR PAIR", Clr_Heading_1); Draw_OnChart_C1("AvgPips03", (t_Line_no - 2), (t_Col_no + t_Offset), "1-Hour", Clr_Heading_1); Draw_OnChart_C1("AvgPips04", (t_Line_no - 1), (t_Col_no + t_Offset), "AVG-Pips", Clr_Heading_1); //LOOP TO DISPLAY AVERAGE VALUES for (int i = 0; i < 8; i++) { // CONVERT t_Last_Price to STRING FOR UNIQUE OBJECT NAME IN Draw_OnChart_C1 METHOD temp_1 = i.ToString(); // SORT AS PER THE CURRENT SORTED MAJOR PAIR VALUES t_1 = Sorted_MajorPair_Hourly_Total_Pips[0, i]; // GET SYMBOL CODE AS PER THE t_Index tstr_Symbol_Code = i.ToString("0") + ". " + MajorPair_Headings[t_1]; // GET WEEKLY TOTAL PIPS MOVED FROM OPEN AND CONVERT TO STRING t_Total_Pip = Avg_All_MajorPair_Total_Pips[t_1, t_TF]; tstr_TPips = t_Total_Pip.ToString("0"); // GET TOTAL PIP FOR COMPARISON WITH AVERAGE TO SET THE COLOR t_2 = Math.Abs(All_MajorPair_Total_Pips[0, t_1, t_TF]); // SET COLOR NAME ON POSITIVE OR NEGATIVE TOTAL PIP FROM OPEN if (t_2 >= t_Total_Pip) t_Clr = Clr_Above; else t_Clr = Clr_Below; // DRAW ON CHART(OBJ_NAME, LINE#, COL#, Text_To_Display, ColorName); Draw_OnChart_C1("AVGPips05" + temp_1, t_Line_no, (t_Col_no), tstr_Symbol_Code, Clr_PairListing); Draw_OnChart_C1("AVGPips06" + temp_1, t_Line_no, (t_Col_no + t_Offset), tstr_TPips, t_Clr); // INC. THE LINE # t_Line_no += 1; // LEAVE A BLANK LINE if (i == 3) t_Line_no += 1; } //END FOR I // DISPLAY : AVERAGE OF 28 PAIRS TOTAL PIPS : CURRENT MONTH if (GTotal_28Pair_Total_Pips[0, t_TF] >= 0) t_Clr = Clr_Positive; else t_Clr = Clr_Negative; tstr_GrandTotal = (GTotal_28Pair_Total_Pips[0, t_TF] / 28).ToString("0"); Draw_OnChart_C1("AvgPips07", t_Line_no, (t_Col_no), "Avg of 28-Pairs", t_Clr); Draw_OnChart_C1("AvgPips08", t_Line_no, (t_Col_no + t_Offset), tstr_GrandTotal, t_Clr); // DISPLAY TOTAL PIPS --------------------------------------------------------------------------------- // RESET ROW COL POSITION TO DISPLAY THE NEXT LOOP VALUES t_Line_no = t_Row; t_Col_no = t_Col_no + 4; // LOOP TO DISPLAY LAST x VALUES for (int l = 0; l < LP1; l++) { // CONVERT t_Last_Price to STRING FOR UNIQUE OBJECT NAME IN Draw_OnChart_C1 METHOD temp_1 = l.ToString(); // GET THE TIME FRAME NAME tstr_TFrame = LP1_TF_Name[l]; // COLUMN HEADINGs Draw_OnChart_C1("PrvMPips01" + temp_1, (t_Line_no - 2), (t_Col_no), tstr_TFrame, Clr_Heading_1); Draw_OnChart_C1("PrvMPips02" + temp_1, (t_Line_no - 1), (t_Col_no), "MAJOR PAIR", Clr_Heading_1); Draw_OnChart_C1("PrvPMPips03" + temp_1, (t_Line_no - 2), (t_Col_no + t_Offset), "1-Hour", Clr_Heading_1); Draw_OnChart_C1("PrvPMPips04" + temp_1, (t_Line_no - 1), (t_Col_no + t_Offset), "T-Pips", Clr_Heading_1); Draw_OnChart_C1("PrvPMPips05" + temp_1, (t_Line_no - 2), (t_Col_no + t_Offset + 1), "1-Hour", Clr_Heading_1); Draw_OnChart_C1("PrvPMPips06" + temp_1, (t_Line_no - 1), (t_Col_no + t_Offset + 1), "ATR", Clr_Heading_1); // LOOP FOR 8 MAJOR-PAIRS : DISPLAY SYMBOL CODE AND TOTAL PIPS ON CHART for (int i = 0; i < 8; i++) { // GET THE SYMBOL INDEX FROM THE SORTED TEMP ARRAY t_1 = Sorted_MajorPair_Hourly_Total_Pips[l, i]; // GET SYMBOL CODE AS PER THE t_Index tstr_Symbol_Code = i.ToString("0") + ". " + MajorPair_Headings[t_1]; // GET WEEKLY TOTAL PIPS MOVED FROM OPEN AND CONVERT TO STRING t_Total_Pip = All_MajorPair_Total_Pips[l, t_1, t_TF]; tstr_TPips = t_Total_Pip.ToString("0"); // GET ATR VALUE t_ATR = All_MajorPair_ATR_Value[l, t_1, t_TF]; tstr_ATR = t_ATR.ToString(); // SET COLOR NAME ON POSITIVE OR NEGATIVE TOTAL PIP FROM OPEN if (t_Total_Pip >= 0) t_Clr = Clr_Positive; else t_Clr = Clr_Negative; // SET COLOR NAME ON POSITIVE OR NEGATIVE TOTAL PIP FROM OPEN if (t_Total_Pip >= t_ATR) t_Clr = Clr_Above; // DRAW ON CHART(OBJ_NAME, LINE#, COL#, Text_To_Display, ColorName); Draw_OnChart_C1("PrvMPips07" + temp_1, t_Line_no, (t_Col_no), tstr_Symbol_Code, Clr_PairListing); Draw_OnChart_C1("PrvMPips08" + temp_1, t_Line_no, (t_Col_no + t_Offset), tstr_TPips, t_Clr); // SET COLOR NAME ON POSITIVE OR NEGATIVE TOTAL PIP FROM OPEN if (t_Total_Pip >= 0) t_Clr = Clr_Positive; else t_Clr = Clr_Negative; // DRAW ATR VALUES ON CHART Draw_OnChart_C1("PrvMPips10" + temp_1, t_Line_no, (t_Col_no + t_Offset + 1), tstr_ATR, t_Clr); // INC. THE LINE # t_Line_no += 1; // LEAVE A BLANK LINE if (i == 3) t_Line_no += 1; } //END FOR I // ---------------------------------------------------------------------------------------------------------- // ON THE LAST LINE DISPLAY THE GRAND TOTAL OF ALL 28PAIRS : DAILY // SET COLOR NAME ON POSITIVE OR NEGATIVE TOTAL PIP FROM OPEN if (GTotal_28Pair_Total_Pips[l, t_TF] >= 0) t_Clr = Clr_Positive; else t_Clr = Clr_Negative; // DISPLAY GRAND_TOTAL OF TOTAL_DAILY_PIPS tstr_GrandTotal = GTotal_28Pair_Total_Pips[l, t_TF].ToString("0"); tstr_ATR = GTotal_28Pair_ATR_Value[l, t_TF].ToString(""); Draw_OnChart_C1("PrvMPips11" + temp_1, t_Line_no, (t_Col_no), "Total 28-Pairs", t_Clr); Draw_OnChart_C1("PrvMPips12" + temp_1, t_Line_no, (t_Col_no + t_Offset), tstr_GrandTotal, t_Clr); Draw_OnChart_C1("PrvMPips13" + temp_1, t_Line_no, (t_Col_no + t_Offset + 1), tstr_ATR, t_Clr); // INCREASE THE LINE SPACE FOR NEXT SET OF TIMEFRAME VALUES t_Line_no = t_Row; t_Col_no = t_Col_no + 5; } // END FOR L } //END MEHTOD Display_MajorPair_Hourly_Total_Pips ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// Display_MajorPair_4Hour_Total_Pips /////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void Display_MajorPair_4Hour_Total_Pips(int t_Row, int t_Col) { int t_Line_no = 0, t_Col_no = 0, t_Offset = 0, t_1 = 0; double t_Total_Pip = 0, t_2 = 0; double t_ATR; int t_TF; string tstr_TPips, tstr_Symbol_Code, temp_1, tstr_TFrame, tstr_GrandTotal, tstr_ATR; Colors t_Clr; //SET TIME FRAME 0=5MIN, 1=15MIN, 2=1HR, 3=4HR, 4=D, 5=W, 6=M. t_TF = 3; // SET THE LINE # AND COLUMN # t_Line_no = t_Row; t_Col_no = t_Col; t_Offset = 2; // DISPLAY AVERAGE VALUES --------------------------------------------------------------------------------- // COLUMN HEADINGs Draw_OnChart_C1("AvgPips01", (t_Line_no - 2), (t_Col_no), "AVERAGE", Clr_Heading_1); Draw_OnChart_C1("AvgPips02", (t_Line_no - 1), (t_Col_no), "MAJOR PAIR", Clr_Heading_1); Draw_OnChart_C1("AvgPips03", (t_Line_no - 2), (t_Col_no + t_Offset), "4-Hour", Clr_Heading_1); Draw_OnChart_C1("AvgPips04", (t_Line_no - 1), (t_Col_no + t_Offset), "AVG-Pips", Clr_Heading_1); //LOOP TO DISPLAY AVERAGE VALUES for (int i = 0; i < 8; i++) { // CONVERT t_Last_Price to STRING FOR UNIQUE OBJECT NAME IN Draw_OnChart_C1 METHOD temp_1 = i.ToString(); // SORT AS PER THE CURRENT SORTED MAJOR PAIR VALUES t_1 = Sorted_MajorPair_4Hour_Total_Pips[0, i]; // GET SYMBOL CODE AS PER THE t_Index tstr_Symbol_Code = i.ToString("0") + ". " + MajorPair_Headings[t_1]; // GET WEEKLY TOTAL PIPS MOVED FROM OPEN AND CONVERT TO STRING t_Total_Pip = Avg_All_MajorPair_Total_Pips[t_1, t_TF]; tstr_TPips = t_Total_Pip.ToString("0"); // GET TOTAL PIP FOR COMPARISON WITH AVERAGE TO SET THE COLOR t_2 = Math.Abs(All_MajorPair_Total_Pips[0, t_1, t_TF]); // SET COLOR NAME ON POSITIVE OR NEGATIVE TOTAL PIP FROM OPEN if (t_2 >= t_Total_Pip) t_Clr = Clr_Above; else t_Clr = Clr_Below; // DRAW ON CHART(OBJ_NAME, LINE#, COL#, Text_To_Display, ColorName); Draw_OnChart_C1("AVGPips05" + temp_1, t_Line_no, (t_Col_no), tstr_Symbol_Code, Clr_PairListing); Draw_OnChart_C1("AVGPips06" + temp_1, t_Line_no, (t_Col_no + t_Offset), tstr_TPips, t_Clr); // INC. THE LINE # t_Line_no += 1; // LEAVE A BLANK LINE if (i == 3) t_Line_no += 1; } //END FOR I // DISPLAY : AVERAGE OF 28 PAIRS TOTAL PIPS : CURRENT MONTH if (GTotal_28Pair_Total_Pips[0, t_TF] >= 0) t_Clr = Clr_Positive; else t_Clr = Clr_Negative; tstr_GrandTotal = (GTotal_28Pair_Total_Pips[0, t_TF] / 28).ToString("0"); Draw_OnChart_C1("AvgPips07", t_Line_no, (t_Col_no), "Avg of 28-Pairs", t_Clr); Draw_OnChart_C1("AvgPips08", t_Line_no, (t_Col_no + t_Offset), tstr_GrandTotal, t_Clr); // DISPLAY TOTAL PIPS --------------------------------------------------------------------------------- // RESET ROW COL POSITION TO DISPLAY THE NEXT LOOP VALUES t_Line_no = t_Row; t_Col_no = t_Col_no + 4; // LOOP TO DISPLAY LAST x VALUES for (int l = 0; l < LP1; l++) { // CONVERT t_Last_Price to STRING FOR UNIQUE OBJECT NAME IN Draw_OnChart_C1 METHOD temp_1 = l.ToString(); // GET THE TIME FRAME NAME tstr_TFrame = LP1_TF_Name[l]; // COLUMN HEADINGs Draw_OnChart_C1("PrvMPips01" + temp_1, (t_Line_no - 2), (t_Col_no), tstr_TFrame, Clr_Heading_1); Draw_OnChart_C1("PrvMPips02" + temp_1, (t_Line_no - 1), (t_Col_no), "MAJOR PAIR", Clr_Heading_1); Draw_OnChart_C1("PrvPMPips03" + temp_1, (t_Line_no - 2), (t_Col_no + t_Offset), "4-Hour", Clr_Heading_1); Draw_OnChart_C1("PrvPMPips04" + temp_1, (t_Line_no - 1), (t_Col_no + t_Offset), "T-Pips", Clr_Heading_1); Draw_OnChart_C1("PrvPMPips05" + temp_1, (t_Line_no - 2), (t_Col_no + t_Offset + 1), "4-Hour", Clr_Heading_1); Draw_OnChart_C1("PrvPMPips06" + temp_1, (t_Line_no - 1), (t_Col_no + t_Offset + 1), "ATR", Clr_Heading_1); // LOOP FOR 8 MAJOR-PAIRS : DISPLAY SYMBOL CODE AND TOTAL PIPS ON CHART for (int i = 0; i < 8; i++) { // GET THE SYMBOL INDEX FROM THE SORTED TEMP ARRAY t_1 = Sorted_MajorPair_4Hour_Total_Pips[l, i]; // GET SYMBOL CODE AS PER THE t_Index tstr_Symbol_Code = i.ToString("0") + ". " + MajorPair_Headings[t_1]; // GET WEEKLY TOTAL PIPS MOVED FROM OPEN AND CONVERT TO STRING t_Total_Pip = All_MajorPair_Total_Pips[l, t_1, t_TF]; tstr_TPips = t_Total_Pip.ToString("0"); // GET ATR VALUE t_ATR = All_MajorPair_ATR_Value[l, t_1, t_TF]; tstr_ATR = t_ATR.ToString(); // SET COLOR NAME ON POSITIVE OR NEGATIVE TOTAL PIP FROM OPEN if (t_Total_Pip >= 0) t_Clr = Clr_Positive; else t_Clr = Clr_Negative; // SET COLOR NAME ON POSITIVE OR NEGATIVE TOTAL PIP FROM OPEN if (t_Total_Pip >= t_ATR) t_Clr = Clr_Above; // DRAW ON CHART(OBJ_NAME, LINE#, COL#, Text_To_Display, ColorName); Draw_OnChart_C1("PrvMPips07" + temp_1, t_Line_no, (t_Col_no), tstr_Symbol_Code, Clr_PairListing); Draw_OnChart_C1("PrvMPips08" + temp_1, t_Line_no, (t_Col_no + t_Offset), tstr_TPips, t_Clr); // SET COLOR NAME ON POSITIVE OR NEGATIVE TOTAL PIP FROM OPEN if (t_Total_Pip >= 0) t_Clr = Clr_Positive; else t_Clr = Clr_Negative; // DRAW ATR VALUES ON CHART Draw_OnChart_C1("PrvMPips10" + temp_1, t_Line_no, (t_Col_no + t_Offset + 1), tstr_ATR, t_Clr); // INC. THE LINE # t_Line_no += 1; // LEAVE A BLANK LINE if (i == 3) t_Line_no += 1; } //END FOR I // ---------------------------------------------------------------------------------------------------------- // ON THE LAST LINE DISPLAY THE GRAND TOTAL OF ALL 28PAIRS : DAILY // SET COLOR NAME ON POSITIVE OR NEGATIVE TOTAL PIP FROM OPEN if (GTotal_28Pair_Total_Pips[l, t_TF] >= 0) t_Clr = Clr_Positive; else t_Clr = Clr_Negative; // DISPLAY GRAND_TOTAL OF TOTAL_DAILY_PIPS tstr_GrandTotal = GTotal_28Pair_Total_Pips[l, t_TF].ToString("0"); tstr_ATR = GTotal_28Pair_ATR_Value[l, t_TF].ToString(""); Draw_OnChart_C1("PrvMPips11" + temp_1, t_Line_no, (t_Col_no), "Total 28-Pairs", t_Clr); Draw_OnChart_C1("PrvMPips12" + temp_1, t_Line_no, (t_Col_no + t_Offset), tstr_GrandTotal, t_Clr); Draw_OnChart_C1("PrvMPips13" + temp_1, t_Line_no, (t_Col_no + t_Offset + 1), tstr_ATR, t_Clr); // INCREASE THE LINE SPACE FOR NEXT SET OF TIMEFRAME VALUES t_Line_no = t_Row; t_Col_no = t_Col_no + 5; } // END FOR L } //END MEHTOD Display_MajorPair_4Hour_Total_Pips ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// Display_MajorPair_Daily_Total_Pips /////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void Display_MajorPair_Daily_Total_Pips(int t_Row, int t_Col) { int t_Line_no = 0, t_Col_no = 0, t_Offset = 0, t_1 = 0; double t_Total_Pip = 0, t_2 = 0; double t_ATR; int t_TF; string tstr_TPips, tstr_Symbol_Code, temp_1, tstr_TFrame, tstr_GrandTotal, tstr_ATR; Colors t_Clr; //SET TIME FRAME 0=5MIN, 1=15MIN, 2=1HR, 3=4HR, 4=D, 5=W, 6=M. t_TF = 4; // SET THE LINE # AND COLUMN # t_Line_no = t_Row; t_Col_no = t_Col; t_Offset = 2; // DISPLAY AVERAGE VALUES --------------------------------------------------------------------------------- // COLUMN HEADINGs Draw_OnChart_C1("AvgPips01", (t_Line_no - 2), (t_Col_no), "AVERAGE", Clr_Heading_1); Draw_OnChart_C1("AvgPips02", (t_Line_no - 1), (t_Col_no), "MAJOR PAIR", Clr_Heading_1); Draw_OnChart_C1("AvgPips03", (t_Line_no - 2), (t_Col_no + t_Offset), "Daily", Clr_Heading_1); Draw_OnChart_C1("AvgPips04", (t_Line_no - 1), (t_Col_no + t_Offset), "AVG-Pips", Clr_Heading_1); //LOOP TO DISPLAY AVERAGE VALUES for (int i = 0; i < 8; i++) { // CONVERT t_Last_Price to STRING FOR UNIQUE OBJECT NAME IN Draw_OnChart_C1 METHOD temp_1 = i.ToString(); // SORT AS PER THE CURRENT SORTED MAJOR PAIR VALUES t_1 = Sorted_MajorPair_Daily_Total_Pips[0, i]; // GET SYMBOL CODE AS PER THE t_Index tstr_Symbol_Code = i.ToString("0") + ". " + MajorPair_Headings[t_1]; // GET WEEKLY TOTAL PIPS MOVED FROM OPEN AND CONVERT TO STRING t_Total_Pip = Avg_All_MajorPair_Total_Pips[t_1, t_TF]; tstr_TPips = t_Total_Pip.ToString("0"); // GET TOTAL PIP FOR COMPARISON WITH AVERAGE TO SET THE COLOR t_2 = Math.Abs(All_MajorPair_Total_Pips[0, t_1, t_TF]); // SET COLOR NAME ON POSITIVE OR NEGATIVE TOTAL PIP FROM OPEN if (t_2 >= t_Total_Pip) t_Clr = Clr_Above; else t_Clr = Clr_Below; // DRAW ON CHART(OBJ_NAME, LINE#, COL#, Text_To_Display, ColorName); Draw_OnChart_C1("AVGPips05" + temp_1, t_Line_no, (t_Col_no), tstr_Symbol_Code, Clr_PairListing); Draw_OnChart_C1("AVGPips06" + temp_1, t_Line_no, (t_Col_no + t_Offset), tstr_TPips, t_Clr); // INC. THE LINE # t_Line_no += 1; // LEAVE A BLANK LINE if (i == 3) t_Line_no += 1; } //END FOR I // DISPLAY : AVERAGE OF 28 PAIRS TOTAL PIPS : CURRENT MONTH if (GTotal_28Pair_Total_Pips[0, t_TF] >= 0) t_Clr = Clr_Positive; else t_Clr = Clr_Negative; tstr_GrandTotal = (GTotal_28Pair_Total_Pips[0, t_TF] / 28).ToString("0"); Draw_OnChart_C1("AvgPips07", t_Line_no, (t_Col_no), "Avg of 28-Pairs", t_Clr); Draw_OnChart_C1("AvgPips08", t_Line_no, (t_Col_no + t_Offset), tstr_GrandTotal, t_Clr); // DISPLAY TOTAL PIPS --------------------------------------------------------------------------------- // RESET ROW COL POSITION TO DISPLAY THE NEXT LOOP VALUES t_Line_no = t_Row; t_Col_no = t_Col_no + 4; // LOOP TO DISPLAY LAST x VALUES for (int l = 0; l < LP1; l++) { // CONVERT t_Last_Price to STRING FOR UNIQUE OBJECT NAME IN Draw_OnChart_C1 METHOD temp_1 = l.ToString(); // GET THE TIME FRAME NAME tstr_TFrame = LP1_TF_Name[l]; // COLUMN HEADINGs Draw_OnChart_C1("PrvMPips01" + temp_1, (t_Line_no - 2), (t_Col_no), tstr_TFrame, Clr_Heading_1); Draw_OnChart_C1("PrvMPips02" + temp_1, (t_Line_no - 1), (t_Col_no), "MAJOR PAIR", Clr_Heading_1); Draw_OnChart_C1("PrvPMPips03" + temp_1, (t_Line_no - 2), (t_Col_no + t_Offset), "Daily", Clr_Heading_1); Draw_OnChart_C1("PrvPMPips04" + temp_1, (t_Line_no - 1), (t_Col_no + t_Offset), "T-Pips", Clr_Heading_1); Draw_OnChart_C1("PrvPMPips05" + temp_1, (t_Line_no - 2), (t_Col_no + t_Offset + 1), "Daily", Clr_Heading_1); Draw_OnChart_C1("PrvPMPips06" + temp_1, (t_Line_no - 1), (t_Col_no + t_Offset + 1), "ATR", Clr_Heading_1); // LOOP FOR 8 MAJOR-PAIRS : DISPLAY SYMBOL CODE AND TOTAL PIPS ON CHART for (int i = 0; i < 8; i++) { // GET THE SYMBOL INDEX FROM THE SORTED TEMP ARRAY t_1 = Sorted_MajorPair_Daily_Total_Pips[l, i]; // GET SYMBOL CODE AS PER THE t_Index tstr_Symbol_Code = i.ToString("0") + ". " + MajorPair_Headings[t_1]; // GET WEEKLY TOTAL PIPS MOVED FROM OPEN AND CONVERT TO STRING t_Total_Pip = All_MajorPair_Total_Pips[l, t_1, t_TF]; tstr_TPips = t_Total_Pip.ToString("0"); // GET ATR VALUE t_ATR = All_MajorPair_ATR_Value[l, t_1, t_TF]; tstr_ATR = t_ATR.ToString(); // SET COLOR NAME ON POSITIVE OR NEGATIVE TOTAL PIP FROM OPEN if (t_Total_Pip >= 0) t_Clr = Clr_Positive; else t_Clr = Clr_Negative; // SET COLOR NAME ON POSITIVE OR NEGATIVE TOTAL PIP FROM OPEN if (t_Total_Pip >= t_ATR) t_Clr = Clr_Above; // DRAW ON CHART(OBJ_NAME, LINE#, COL#, Text_To_Display, ColorName); Draw_OnChart_C1("PrvMPips07" + temp_1, t_Line_no, (t_Col_no), tstr_Symbol_Code, Clr_PairListing); Draw_OnChart_C1("PrvMPips08" + temp_1, t_Line_no, (t_Col_no + t_Offset), tstr_TPips, t_Clr); // SET COLOR NAME ON POSITIVE OR NEGATIVE TOTAL PIP FROM OPEN if (t_Total_Pip >= 0) t_Clr = Clr_Positive; else t_Clr = Clr_Negative; // DRAW ATR VALUES ON CHART Draw_OnChart_C1("PrvMPips10" + temp_1, t_Line_no, (t_Col_no + t_Offset + 1), tstr_ATR, t_Clr); // INC. THE LINE # t_Line_no += 1; // LEAVE A BLANK LINE if (i == 3) t_Line_no += 1; } //END FOR I // ---------------------------------------------------------------------------------------------------------- // ON THE LAST LINE DISPLAY THE GRAND TOTAL OF ALL 28PAIRS : DAILY // SET COLOR NAME ON POSITIVE OR NEGATIVE TOTAL PIP FROM OPEN if (GTotal_28Pair_Total_Pips[l, t_TF] >= 0) t_Clr = Clr_Positive; else t_Clr = Clr_Negative; // DISPLAY GRAND_TOTAL OF TOTAL_DAILY_PIPS tstr_GrandTotal = GTotal_28Pair_Total_Pips[l, t_TF].ToString("0"); tstr_ATR = GTotal_28Pair_ATR_Value[l, t_TF].ToString(""); Draw_OnChart_C1("PrvMPips11" + temp_1, t_Line_no, (t_Col_no), "Total 28-Pairs", t_Clr); Draw_OnChart_C1("PrvMPips12" + temp_1, t_Line_no, (t_Col_no + t_Offset), tstr_GrandTotal, t_Clr); Draw_OnChart_C1("PrvMPips13" + temp_1, t_Line_no, (t_Col_no + t_Offset + 1), tstr_ATR, t_Clr); // INCREASE THE LINE SPACE FOR NEXT SET OF TIMEFRAME VALUES t_Line_no = t_Row; t_Col_no = t_Col_no + 5; } // END FOR L } //END MEHTOD Display_MajorPair_Daily_Total_Pips ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// Display_MajorPair_Weekly_Total_Pips /////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void Display_MajorPair_Weekly_Total_Pips(int t_Row, int t_Col) { int t_Line_no = 0, t_Col_no = 0, t_Offset = 0, t_1 = 0; double t_Total_Pip = 0, t_2 = 0; double t_ATR; int t_TF; string tstr_TPips, tstr_Symbol_Code, temp_1, tstr_TFrame, tstr_GrandTotal, tstr_ATR; Colors t_Clr; //SET TIME FRAME 0=5MIN, 1=15MIN, 2=1HR, 3=4HR, 4=D, 5=W, 6=M. t_TF = 5; // SET THE LINE # AND COLUMN # t_Line_no = t_Row; t_Col_no = t_Col; t_Offset = 2; // DISPLAY AVERAGE VALUES --------------------------------------------------------------------------------- // COLUMN HEADINGs Draw_OnChart_C1("AvgPips01", (t_Line_no - 2), (t_Col_no), "AVERAGE", Clr_Heading_1); Draw_OnChart_C1("AvgPips02", (t_Line_no - 1), (t_Col_no), "MAJOR PAIR", Clr_Heading_1); Draw_OnChart_C1("AvgPips03", (t_Line_no - 2), (t_Col_no + t_Offset), "Weekly", Clr_Heading_1); Draw_OnChart_C1("AvgPips04", (t_Line_no - 1), (t_Col_no + t_Offset), "AVG-Pips", Clr_Heading_1); //LOOP TO DISPLAY AVERAGE VALUES for (int i = 0; i < 8; i++) { // CONVERT t_Last_Price to STRING FOR UNIQUE OBJECT NAME IN Draw_OnChart_C1 METHOD temp_1 = i.ToString(); // SORT AS PER THE CURRENT SORTED MAJOR PAIR VALUES t_1 = Sorted_MajorPair_Weekly_Total_Pips[0, i]; // GET SYMBOL CODE AS PER THE t_Index tstr_Symbol_Code = i.ToString("0") + ". " + MajorPair_Headings[t_1]; // GET WEEKLY TOTAL PIPS MOVED FROM OPEN AND CONVERT TO STRING t_Total_Pip = Avg_All_MajorPair_Total_Pips[t_1, t_TF]; tstr_TPips = t_Total_Pip.ToString("0"); // GET TOTAL PIP FOR COMPARISON WITH AVERAGE TO SET THE COLOR t_2 = Math.Abs(All_MajorPair_Total_Pips[0, t_1, t_TF]); // SET COLOR NAME ON POSITIVE OR NEGATIVE TOTAL PIP FROM OPEN if (t_2 >= t_Total_Pip) t_Clr = Clr_Above; else t_Clr = Clr_Below; // DRAW ON CHART(OBJ_NAME, LINE#, COL#, Text_To_Display, ColorName); Draw_OnChart_C1("AVGPips05" + temp_1, t_Line_no, (t_Col_no), tstr_Symbol_Code, Clr_PairListing); Draw_OnChart_C1("AVGPips06" + temp_1, t_Line_no, (t_Col_no + t_Offset), tstr_TPips, t_Clr); // INC. THE LINE # t_Line_no += 1; // LEAVE A BLANK LINE if (i == 3) t_Line_no += 1; } //END FOR I // DISPLAY : AVERAGE OF 28 PAIRS TOTAL PIPS : CURRENT MONTH if (GTotal_28Pair_Total_Pips[0, t_TF] >= 0) t_Clr = Clr_Positive; else t_Clr = Clr_Negative; tstr_GrandTotal = (GTotal_28Pair_Total_Pips[0, t_TF] / 28).ToString("0"); Draw_OnChart_C1("AvgPips07", t_Line_no, (t_Col_no), "Avg of 28-Pairs", t_Clr); Draw_OnChart_C1("AvgPips08", t_Line_no, (t_Col_no + t_Offset), tstr_GrandTotal, t_Clr); // DISPLAY TOTAL PIPS --------------------------------------------------------------------------------- // RESET ROW COL POSITION TO DISPLAY THE NEXT LOOP VALUES t_Line_no = t_Row; t_Col_no = t_Col_no + 4; // LOOP TO DISPLAY LAST x VALUES for (int l = 0; l < LP1; l++) { // CONVERT t_Last_Price to STRING FOR UNIQUE OBJECT NAME IN Draw_OnChart_C1 METHOD temp_1 = l.ToString(); // GET THE TIME FRAME NAME tstr_TFrame = LP1_TF_Name[l]; // COLUMN HEADINGs Draw_OnChart_C1("PrvMPips01" + temp_1, (t_Line_no - 2), (t_Col_no), tstr_TFrame, Clr_Heading_1); Draw_OnChart_C1("PrvMPips02" + temp_1, (t_Line_no - 1), (t_Col_no), "MAJOR PAIR", Clr_Heading_1); Draw_OnChart_C1("PrvPMPips03" + temp_1, (t_Line_no - 2), (t_Col_no + t_Offset), "Week", Clr_Heading_1); Draw_OnChart_C1("PrvPMPips04" + temp_1, (t_Line_no - 1), (t_Col_no + t_Offset), "T-Pips", Clr_Heading_1); Draw_OnChart_C1("PrvPMPips05" + temp_1, (t_Line_no - 2), (t_Col_no + t_Offset + 1), "Week", Clr_Heading_1); Draw_OnChart_C1("PrvPMPips06" + temp_1, (t_Line_no - 1), (t_Col_no + t_Offset + 1), "ATR", Clr_Heading_1); // LOOP FOR 8 MAJOR-PAIRS : DISPLAY SYMBOL CODE AND TOTAL PIPS ON CHART for (int i = 0; i < 8; i++) { // GET THE SYMBOL INDEX FROM THE SORTED TEMP ARRAY t_1 = Sorted_MajorPair_Weekly_Total_Pips[l, i]; // GET SYMBOL CODE AS PER THE t_Index tstr_Symbol_Code = i.ToString("0") + ". " + MajorPair_Headings[t_1]; // GET WEEKLY TOTAL PIPS MOVED FROM OPEN AND CONVERT TO STRING t_Total_Pip = All_MajorPair_Total_Pips[l, t_1, t_TF]; tstr_TPips = t_Total_Pip.ToString("0"); // GET ATR VALUE t_ATR = All_MajorPair_ATR_Value[l, t_1, t_TF]; tstr_ATR = t_ATR.ToString(); // SET COLOR NAME ON POSITIVE OR NEGATIVE TOTAL PIP FROM OPEN if (t_Total_Pip >= 0) t_Clr = Clr_Positive; else t_Clr = Clr_Negative; // SET COLOR NAME ON POSITIVE OR NEGATIVE TOTAL PIP FROM OPEN if (t_Total_Pip >= t_ATR) t_Clr = Clr_Above; // DRAW ON CHART(OBJ_NAME, LINE#, COL#, Text_To_Display, ColorName); Draw_OnChart_C1("PrvMPips07" + temp_1, t_Line_no, (t_Col_no), tstr_Symbol_Code, Clr_PairListing); Draw_OnChart_C1("PrvMPips08" + temp_1, t_Line_no, (t_Col_no + t_Offset), tstr_TPips, t_Clr); // SET COLOR NAME ON POSITIVE OR NEGATIVE TOTAL PIP FROM OPEN if (t_Total_Pip >= 0) t_Clr = Clr_Positive; else t_Clr = Clr_Negative; // DRAW ATR VALUES ON CHART Draw_OnChart_C1("PrvMPips10" + temp_1, t_Line_no, (t_Col_no + t_Offset + 1), tstr_ATR, t_Clr); // INC. THE LINE # t_Line_no += 1; // LEAVE A BLANK LINE if (i == 3) t_Line_no += 1; } //END FOR I // ---------------------------------------------------------------------------------------------------------- // ON THE LAST LINE DISPLAY THE GRAND TOTAL OF ALL 28PAIRS : DAILY // SET COLOR NAME ON POSITIVE OR NEGATIVE TOTAL PIP FROM OPEN if (GTotal_28Pair_Total_Pips[l, t_TF] >= 0) t_Clr = Clr_Positive; else t_Clr = Clr_Negative; // DISPLAY GRAND_TOTAL OF TOTAL_DAILY_PIPS tstr_GrandTotal = GTotal_28Pair_Total_Pips[l, t_TF].ToString("0"); tstr_ATR = GTotal_28Pair_ATR_Value[l, t_TF].ToString(""); Draw_OnChart_C1("PrvMPips11" + temp_1, t_Line_no, (t_Col_no), "Total 28-Pairs", t_Clr); Draw_OnChart_C1("PrvMPips12" + temp_1, t_Line_no, (t_Col_no + t_Offset), tstr_GrandTotal, t_Clr); Draw_OnChart_C1("PrvMPips13" + temp_1, t_Line_no, (t_Col_no + t_Offset + 1), tstr_ATR, t_Clr); // INCREASE THE LINE SPACE FOR NEXT SET OF TIMEFRAME VALUES t_Line_no = t_Row; t_Col_no = t_Col_no + 5; } // END FOR L } //END MEHTOD Display_MajorPair_Weekly_Total_Pips ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// Display_MajorPair_Monthly_Total_Pips /////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void Display_MajorPair_Monthly_Total_Pips(int t_Row, int t_Col) { int t_Line_no = 0, t_Col_no = 0, t_Offset = 0, t_1 = 0; double t_Total_Pip = 0, t_2 = 0; double t_ATR; int t_TF; string tstr_TPips, tstr_Symbol_Code, temp_1, tstr_TFrame, tstr_GrandTotal, tstr_ATR; Colors t_Clr; //SET TIME FRAME 0=5MIN, 1=15MIN, 2=1HR, 3=4HR, 4=D, 5=W, 6=M. t_TF = 6; // SET THE LINE # AND COLUMN # t_Line_no = t_Row; t_Col_no = t_Col; t_Offset = 2; // DISPLAY AVERAGE VALUES --------------------------------------------------------------------------------- // COLUMN HEADINGs Draw_OnChart_C1("AvgPips01", (t_Line_no - 2), (t_Col_no), "AVERAGE", Clr_Heading_1); Draw_OnChart_C1("AvgPips02", (t_Line_no - 1), (t_Col_no), "MAJOR PAIR", Clr_Heading_1); Draw_OnChart_C1("AvgPips03", (t_Line_no - 2), (t_Col_no + t_Offset), "Month", Clr_Heading_1); Draw_OnChart_C1("AvgPips04", (t_Line_no - 1), (t_Col_no + t_Offset), "AVG-Pips", Clr_Heading_1); //LOOP TO DISPLAY AVERAGE VALUES for (int i = 0; i < 8; i++) { // CONVERT t_Last_Price to STRING FOR UNIQUE OBJECT NAME IN Draw_OnChart_C1 METHOD temp_1 = i.ToString(); // SORT AS PER THE CURRENT SORTED MAJOR PAIR VALUES t_1 = Sorted_MajorPair_Monthly_Total_Pips[0, i]; // GET SYMBOL CODE AS PER THE t_Index tstr_Symbol_Code = i.ToString("0") + ". " + MajorPair_Headings[t_1]; // GET WEEKLY TOTAL PIPS MOVED FROM OPEN AND CONVERT TO STRING t_Total_Pip = Avg_All_MajorPair_Total_Pips[t_1, t_TF]; tstr_TPips = t_Total_Pip.ToString("0"); // GET TOTAL PIP FOR COMPARISON WITH AVERAGE TO SET THE COLOR t_2 = Math.Abs(All_MajorPair_Total_Pips[0, t_1, t_TF]); // SET COLOR NAME ON POSITIVE OR NEGATIVE TOTAL PIP FROM OPEN if (t_2 >= t_Total_Pip) t_Clr = Clr_Above; else t_Clr = Clr_Below; // DRAW ON CHART(OBJ_NAME, LINE#, COL#, Text_To_Display, ColorName); Draw_OnChart_C1("AVGPips05" + temp_1, t_Line_no, (t_Col_no), tstr_Symbol_Code, Clr_PairListing); Draw_OnChart_C1("AVGPips06" + temp_1, t_Line_no, (t_Col_no + t_Offset), tstr_TPips, t_Clr); // INC. THE LINE # t_Line_no += 1; // LEAVE A BLANK LINE if (i == 3) t_Line_no += 1; } //END FOR I // DISPLAY : AVERAGE OF 28 PAIRS TOTAL PIPS : CURRENT MONTH if (GTotal_28Pair_Total_Pips[0, t_TF] >= 0) t_Clr = Clr_Positive; else t_Clr = Clr_Negative; tstr_GrandTotal = (GTotal_28Pair_Total_Pips[0, t_TF] / 28).ToString("0"); Draw_OnChart_C1("AvgPips07", t_Line_no, (t_Col_no), "Avg of 28-Pairs", t_Clr); Draw_OnChart_C1("AvgPips08", t_Line_no, (t_Col_no + t_Offset), tstr_GrandTotal, t_Clr); // DISPLAY TOTAL PIPS --------------------------------------------------------------------------------- // RESET ROW COL POSITION TO DISPLAY THE NEXT LOOP VALUES t_Line_no = t_Row; t_Col_no = t_Col_no + 4; // LOOP TO DISPLAY LAST x VALUES for (int l = 0; l < LP1; l++) { // CONVERT t_Last_Price to STRING FOR UNIQUE OBJECT NAME IN Draw_OnChart_C1 METHOD temp_1 = l.ToString(); // GET THE TIME FRAME NAME tstr_TFrame = LP1_TF_Name[l]; // COLUMN HEADINGs Draw_OnChart_C1("PrvMPips01" + temp_1, (t_Line_no - 2), (t_Col_no), tstr_TFrame, Clr_Heading_1); Draw_OnChart_C1("PrvMPips02" + temp_1, (t_Line_no - 1), (t_Col_no), "MAJOR PAIR", Clr_Heading_1); Draw_OnChart_C1("PrvPMPips03" + temp_1, (t_Line_no - 2), (t_Col_no + t_Offset), "Month", Clr_Heading_1); Draw_OnChart_C1("PrvPMPips04" + temp_1, (t_Line_no - 1), (t_Col_no + t_Offset), "T-Pips", Clr_Heading_1); Draw_OnChart_C1("PrvPMPips05" + temp_1, (t_Line_no - 2), (t_Col_no + t_Offset + 1), "Month", Clr_Heading_1); Draw_OnChart_C1("PrvPMPips06" + temp_1, (t_Line_no - 1), (t_Col_no + t_Offset + 1), "ATR", Clr_Heading_1); // LOOP FOR 8 MAJOR-PAIRS : DISPLAY SYMBOL CODE AND TOTAL PIPS ON CHART for (int i = 0; i < 8; i++) { // GET THE SYMBOL INDEX FROM THE SORTED TEMP ARRAY t_1 = Sorted_MajorPair_Monthly_Total_Pips[l, i]; // GET SYMBOL CODE AS PER THE t_Index tstr_Symbol_Code = i.ToString("0") + ". " + MajorPair_Headings[t_1]; // GET WEEKLY TOTAL PIPS MOVED FROM OPEN AND CONVERT TO STRING t_Total_Pip = All_MajorPair_Total_Pips[l, t_1, t_TF]; tstr_TPips = t_Total_Pip.ToString("0"); // GET ATR VALUE t_ATR = All_MajorPair_ATR_Value[l, t_1, t_TF]; tstr_ATR = t_ATR.ToString(); // SET COLOR NAME ON POSITIVE OR NEGATIVE TOTAL PIP FROM OPEN if (t_Total_Pip >= 0) t_Clr = Clr_Positive; else t_Clr = Clr_Negative; // SET COLOR NAME ON POSITIVE OR NEGATIVE TOTAL PIP FROM OPEN if (t_Total_Pip >= t_ATR) t_Clr = Clr_Above; // DRAW ON CHART(OBJ_NAME, LINE#, COL#, Text_To_Display, ColorName); Draw_OnChart_C1("PrvMPips07" + temp_1, t_Line_no, (t_Col_no), tstr_Symbol_Code, Clr_PairListing); Draw_OnChart_C1("PrvMPips08" + temp_1, t_Line_no, (t_Col_no + t_Offset), tstr_TPips, t_Clr); // SET COLOR NAME ON POSITIVE OR NEGATIVE TOTAL PIP FROM OPEN if (t_Total_Pip >= 0) t_Clr = Clr_Positive; else t_Clr = Clr_Negative; // DRAW ATR VALUES ON CHART Draw_OnChart_C1("PrvMPips10" + temp_1, t_Line_no, (t_Col_no + t_Offset + 1), tstr_ATR, t_Clr); // INC. THE LINE # t_Line_no += 1; // LEAVE A BLANK LINE if (i == 3) t_Line_no += 1; } //END FOR I // ---------------------------------------------------------------------------------------------------------- // ON THE LAST LINE DISPLAY THE GRAND TOTAL OF ALL 28PAIRS : DAILY // SET COLOR NAME ON POSITIVE OR NEGATIVE TOTAL PIP FROM OPEN if (GTotal_28Pair_Total_Pips[l, t_TF] >= 0) t_Clr = Clr_Positive; else t_Clr = Clr_Negative; // DISPLAY GRAND_TOTAL OF TOTAL_DAILY_PIPS tstr_GrandTotal = GTotal_28Pair_Total_Pips[l, t_TF].ToString("0"); tstr_ATR = GTotal_28Pair_ATR_Value[l, t_TF].ToString(""); Draw_OnChart_C1("PrvMPips11" + temp_1, t_Line_no, (t_Col_no), "Total 28-Pairs", t_Clr); Draw_OnChart_C1("PrvMPips12" + temp_1, t_Line_no, (t_Col_no + t_Offset), tstr_GrandTotal, t_Clr); Draw_OnChart_C1("PrvMPips13" + temp_1, t_Line_no, (t_Col_no + t_Offset + 1), tstr_ATR, t_Clr); // INCREASE THE LINE SPACE FOR NEXT SET OF TIMEFRAME VALUES t_Line_no = t_Row; t_Col_no = t_Col_no + 5; } // END FOR L } //END MEHTOD Display_MajorPair_Monthly_Total_Pips ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// Get_MajorPair_Total_Pips /////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void Get_MajorPair_Total_Pips() { string tstr_s1; int t_index; double t_Total = 0, t_GrandTotal = 0; // LOOP FOR PREVIOUS PRICES : LP IS A GLOBAL VARIABLE TO SET THE LOOP LIMIT for (int l = 0; l < LP1; l++) { // FOR : 5MIN, 15MIN, 1HOUR, 4HOUR, DAILY, WEEKLY, MONTHLY for (int k = 0; k < 7; k++) { // 8 - MAJOR PAIR for (int i = 0; i < 8; i++) { // 7 - SUB PAIR for (int j = 0; j < 7; j++) { tstr_s1 = MajorPair_Combo[i, j]; // MEHTOD CALL t_index = Return_Pair_Index_Position(tstr_s1); // GET 15-MINS TOTAL PIPS t_Total += (All_28Pair_Total_Pips[l, t_index, k] * Base_Currency[i, j]); All_MajorPair_Total_Pips[l, i, k] = t_Total; } //END FOR j //RESET t_Total = 0; // GRAND TOTAL OF ALL VALUES t_GrandTotal += All_MajorPair_Total_Pips[l, i, k]; GTotal_MajorPair_Total_Pips[l, k] = t_GrandTotal; } //END FOR i //RESET t_GrandTotal = 0; } //END FOR k } // END FOR l } //END MEHTOD Get_MajorPair_Total_Pips ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// Get_MajorPair_ATR_Values /////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void Get_MajorPair_ATR_Values() { string tstr_s1; int t_index; double t_Total = 0, t_GrandTotal = 0; // LOOP FOR PREVIOUS PRICES : LP IS A GLOBAL VARIABLE TO SET THE LOOP LIMIT for (int l = 0; l < LP1; l++) { // FOR : 5MIN, 15MIN, 1HOUR, 4HOUR, DAILY, WEEKLY, MONTHLY for (int k = 0; k < 7; k++) { // 8 - MAJOR PAIR for (int i = 0; i < 8; i++) { // 7 - SUB PAIR for (int j = 0; j < 7; j++) { tstr_s1 = MajorPair_Combo[i, j]; // MEHTOD CALL t_index = Return_Pair_Index_Position(tstr_s1); // GET 15-MINS TOTAL PIPS t_Total += (All_28Pair_ATR_Value[l, t_index, k]); All_MajorPair_ATR_Value[l, i, k] = t_Total; } //END FOR j //RESET t_Total = 0; // GRAND TOTAL OF ALL VALUES t_GrandTotal += All_MajorPair_ATR_Value[l, i, k]; GTotal_MajorPair_ATR_Value[l, k] = t_GrandTotal; } //END FOR i //RESET t_GrandTotal = 0; } //END FOR k } // END FOR l } //END MEHTOD Get_MajorPair_ATR_Values ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// Load_28Pair_ATR_Values /////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void Load_28Pair_ATR_Values() { double t_PipSize; double t_0 = 0, t_1 = 0, t_2 = 0, t_3 = 0, t_4 = 0, t_5 = 0, t_6 = 0; Symbol t_Symbol; string tstr_Symbol_Code; int t_ind; // LOOP FOR PREVIOUS PRICES : LP IS A GLOBAL VARIABLE TO SET THE LOOP LIMIT for (int l = 0; l < LP1; l++) { t_ind = LP1_Array_Open[l]; //LOOP FOR 28 PAIRS for (int i = 0; i < 28; i++) { // GET SYMBOL t_Symbol = Get_28Pair_Symbol(i); tstr_Symbol_Code = t_Symbol.Code.ToString(); t_PipSize = t_Symbol.PipSize; //GET A TEMP VARIABLE FOR MARKETDATA FOR THE SYMBOL AND TIME FRAME SPECIFIED BY USER // 5-MIN var temp_1 = MarketData.GetSeries(tstr_Symbol_Code, TF_5min); ATR_Indicator_1 = Indicators.AverageTrueRange(temp_1, ATR_P_5min, p_ATR_MA_Type); // 15-MIN var temp_2 = MarketData.GetSeries(tstr_Symbol_Code, TF_15min); ATR_Indicator_2 = Indicators.AverageTrueRange(temp_2, ATR_P_15min, p_ATR_MA_Type); // 1-HOUR var temp_3 = MarketData.GetSeries(tstr_Symbol_Code, TF_1Hr); ATR_Indicator_3 = Indicators.AverageTrueRange(temp_3, ATR_P_1Hr, p_ATR_MA_Type); // 4-HOUR var temp_4 = MarketData.GetSeries(tstr_Symbol_Code, TF_4Hr); ATR_Indicator_4 = Indicators.AverageTrueRange(temp_4, ATR_P_4Hr, p_ATR_MA_Type); // Daily var temp_5 = MarketData.GetSeries(tstr_Symbol_Code, TF_D); ATR_Indicator_5 = Indicators.AverageTrueRange(temp_5, ATR_P_D, p_ATR_MA_Type); // Weekly var temp_6 = MarketData.GetSeries(tstr_Symbol_Code, TF_Wk); ATR_Indicator_6 = Indicators.AverageTrueRange(temp_6, ATR_P_Wk, p_ATR_MA_Type); // Monthly var temp_7 = MarketData.GetSeries(tstr_Symbol_Code, TF_Mt); ATR_Indicator_7 = Indicators.AverageTrueRange(temp_7, ATR_P_Mt, p_ATR_MA_Type); //STORE ATR VALUE IN THE ARRAY. ARRAY STARTS FROM 0 INDEX // 5-MIN All_28Pair_ATR_Value[l, i, 0] = Math.Round(ATR_Indicator_1.Result.Last(t_ind) / t_PipSize, 0); t_0 += All_28Pair_ATR_Value[l, i, 0]; // 15-MIN All_28Pair_ATR_Value[l, i, 1] = Math.Round(ATR_Indicator_2.Result.Last(t_ind) / t_PipSize, 0); t_1 += All_28Pair_ATR_Value[l, i, 1]; // 1-HOUR All_28Pair_ATR_Value[l, i, 2] = Math.Round(ATR_Indicator_3.Result.Last(t_ind) / t_PipSize, 0); t_2 += All_28Pair_ATR_Value[l, i, 2]; // 4-HOUR All_28Pair_ATR_Value[l, i, 3] = Math.Round(ATR_Indicator_4.Result.Last(t_ind) / t_PipSize, 0); t_3 += All_28Pair_ATR_Value[l, i, 3]; // DAILY All_28Pair_ATR_Value[l, i, 4] = Math.Round(ATR_Indicator_5.Result.Last(t_ind) / t_PipSize, 0); t_4 += All_28Pair_ATR_Value[l, i, 4]; // WEEKLY All_28Pair_ATR_Value[l, i, 5] = Math.Round(ATR_Indicator_6.Result.Last(t_ind) / t_PipSize, 0); t_5 += All_28Pair_ATR_Value[l, i, 5]; // MONTHLY All_28Pair_ATR_Value[l, i, 6] = Math.Round(ATR_Indicator_7.Result.Last(t_ind) / t_PipSize, 0); t_6 += All_28Pair_ATR_Value[l, i, 6]; } //END FOR i //UPDATE THE GRANDTOTAL OF "TOTAL ATR VALUE" GTotal_28Pair_ATR_Value[l, 0] = t_0; GTotal_28Pair_ATR_Value[l, 1] = t_1; GTotal_28Pair_ATR_Value[l, 2] = t_2; GTotal_28Pair_ATR_Value[l, 3] = t_3; GTotal_28Pair_ATR_Value[l, 4] = t_4; GTotal_28Pair_ATR_Value[l, 5] = t_5; GTotal_28Pair_ATR_Value[l, 6] = t_6; //RESET t_0 = 0; t_1 = 0; t_2 = 0; t_3 = 0; t_4 = 0; t_5 = 0; t_6 = 0; } // END FOR l } //END MEHTOD Load_28Pair_ATR_Values ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// Get_28Pair_TOTAL_Pips_from_Open /////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void Get_28Pair_TOTAL_Pips_from_Open() { //Print("Inside : TOTAL_Pips_from_Open"); double t_PipSize; double t_0 = 0, t_1 = 0, t_2 = 0, t_3 = 0, t_4 = 0, t_5 = 0, t_6 = 0; double t_Close_P1, t_Close_P2, t_Close_P3, t_Close_P4, t_Close_P5, t_Close_P6, t_Close_P7; double t_Open_P1, t_Open_P2, t_Open_P3, t_Open_P4, t_Open_P5, t_Open_P6, t_Open_P7; // LOOP FOR PREVIOUS PRICES : LP IS A GLOBAL VARIABLE TO SET THE LOOP LIMIT for (int l = 0; l < LP1; l++) { //LOOP FOR 28 PAIRS for (int i = 0; i < 28; i++) { // LOAD PIP SIZE t_PipSize = All_28Pair_Pip_Size[i]; // ---------- LOAD CLOSE PRICE : ALL TIME FRAMES t_Close_P1 = All_28Pair_Close_Price[l, i, 0]; t_Close_P2 = All_28Pair_Close_Price[l, i, 1]; t_Close_P3 = All_28Pair_Close_Price[l, i, 2]; t_Close_P4 = All_28Pair_Close_Price[l, i, 3]; t_Close_P5 = All_28Pair_Close_Price[l, i, 4]; t_Close_P6 = All_28Pair_Close_Price[l, i, 5]; t_Close_P7 = All_28Pair_Close_Price[l, i, 6]; // ---------- LOAD OPEN PRICES : ALL TRIME FRAMES t_Open_P1 = All_28Pair_Open_Price[l, i, 0]; t_Open_P2 = All_28Pair_Open_Price[l, i, 1]; t_Open_P3 = All_28Pair_Open_Price[l, i, 2]; t_Open_P4 = All_28Pair_Open_Price[l, i, 3]; t_Open_P5 = All_28Pair_Open_Price[l, i, 4]; t_Open_P6 = All_28Pair_Open_Price[l, i, 5]; t_Open_P7 = All_28Pair_Open_Price[l, i, 6]; //STORE THE OPEN.LAST VALUE IN THE ARRAY. ARRAY STARTS FROM 0 INDEX // 5-MIN All_28Pair_Total_Pips[l, i, 0] = Math.Round(((t_Close_P1 - t_Open_P1) / t_PipSize), 0); t_0 += All_28Pair_Total_Pips[l, i, 0]; // 15-MIN All_28Pair_Total_Pips[l, i, 1] = Math.Round(((t_Close_P2 - t_Open_P2) / t_PipSize), 0); t_1 += All_28Pair_Total_Pips[l, i, 1]; // 1-HOUR All_28Pair_Total_Pips[l, i, 2] = Math.Round(((t_Close_P3 - t_Open_P3) / t_PipSize), 0); t_2 += All_28Pair_Total_Pips[l, i, 2]; // 4-HOUR All_28Pair_Total_Pips[l, i, 3] = Math.Round(((t_Close_P4 - t_Open_P4) / t_PipSize), 0); t_3 += All_28Pair_Total_Pips[l, i, 3]; // DAILY All_28Pair_Total_Pips[l, i, 4] = Math.Round(((t_Close_P5 - t_Open_P5) / t_PipSize), 0); t_4 += All_28Pair_Total_Pips[l, i, 4]; // WEEKLY All_28Pair_Total_Pips[l, i, 5] = Math.Round(((t_Close_P6 - t_Open_P6) / t_PipSize), 0); t_5 += All_28Pair_Total_Pips[l, i, 5]; // MONTHLY All_28Pair_Total_Pips[l, i, 6] = Math.Round(((t_Close_P7 - t_Open_P7) / t_PipSize), 0); t_6 += All_28Pair_Total_Pips[l, i, 6]; //UPDATE THE GRANDTOTAL OF "TOTAL PIPS" MOVED FROM OPEN PRICES : DAILY, WEEKLY, MONTHLY GTotal_28Pair_Total_Pips[l, 0] = t_0; GTotal_28Pair_Total_Pips[l, 1] = t_1; GTotal_28Pair_Total_Pips[l, 2] = t_2; GTotal_28Pair_Total_Pips[l, 3] = t_3; GTotal_28Pair_Total_Pips[l, 4] = t_4; GTotal_28Pair_Total_Pips[l, 5] = t_5; GTotal_28Pair_Total_Pips[l, 6] = t_6; } //END FOR i //RESET t_0 = 0; t_1 = 0; t_2 = 0; t_3 = 0; t_4 = 0; t_5 = 0; t_6 = 0; } // END FOR L } //END MEHTOD Get_28Pair_TOTAL_Pips_from_Open ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// Load_28Pair_HiLo_Prices /////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void Load_28Pair_HiLo_Prices() { //Print("Inside : -PREVIOUS- : Close AND HiLo Prices"); //double t_1; Symbol t_Symbol; string tstr_Symbol_Code; int t_ind; // LOOP FOR PREVIOUS PRICES : LP IS A GLOBAL VARIABLE TO SET THE LOOP LIMIT for (int l = 0; l < LP1; l++) { t_ind = LP1_Array_Close[l]; //LOOP FOR 28 PAIRS for (int i = 0; i < 28; i++) { // GET SYMBOL t_Symbol = Get_28Pair_Symbol(i); tstr_Symbol_Code = t_Symbol.Code.ToString(); //GET 5-MIN OPEN PRICES FOR THE SYMBOL var temp_1 = MarketData.GetSeries(tstr_Symbol_Code, TF_5min); //GET 15-MIN OPEN PRICES FOR THE SYMBOL var temp_2 = MarketData.GetSeries(tstr_Symbol_Code, TF_15min); //GET 1-HOUR OPEN PRICES FOR THE SYMBOL var temp_3 = MarketData.GetSeries(tstr_Symbol_Code, TF_1Hr); //GET 4-hOUR OPEN PRICES FOR THE SYMBOL var temp_4 = MarketData.GetSeries(tstr_Symbol_Code, TF_4Hr); //GET DAILY OPEN PRICES FOR THE SYMBOL var temp_5 = MarketData.GetSeries(tstr_Symbol_Code, TF_D); //GET Weekly OPEN PRICES FOR THE SYMBOL var temp_6 = MarketData.GetSeries(tstr_Symbol_Code, TF_Wk); //GET Monthly OPEN PRICES FOR THE SYMBOL var temp_7 = MarketData.GetSeries(tstr_Symbol_Code, TF_Mt); // ------------ HI-LO PRICES // 5-MIN All_28Pair_HiLo_Price[l, i, 0] = temp_1.High.Last(t_ind); All_28Pair_HiLo_Price[l, i, 1] = temp_1.Low.Last(t_ind); // 15-MIN All_28Pair_HiLo_Price[l, i, 2] = temp_2.High.Last(t_ind); All_28Pair_HiLo_Price[l, i, 3] = temp_2.Low.Last(t_ind); // 1-HOUR All_28Pair_HiLo_Price[l, i, 4] = temp_3.High.Last(t_ind); All_28Pair_HiLo_Price[l, i, 5] = temp_3.Low.Last(t_ind); // 4-HOUR All_28Pair_HiLo_Price[l, i, 6] = temp_4.High.Last(t_ind); All_28Pair_HiLo_Price[l, i, 7] = temp_4.Low.Last(t_ind); // DAILY All_28Pair_HiLo_Price[l, i, 8] = temp_5.High.Last(t_ind); All_28Pair_HiLo_Price[l, i, 9] = temp_5.Low.Last(t_ind); // WEEKLY All_28Pair_HiLo_Price[l, i, 10] = temp_6.High.Last(t_ind); All_28Pair_HiLo_Price[l, i, 11] = temp_6.Low.Last(t_ind); // MONTHLY All_28Pair_HiLo_Price[l, i, 12] = temp_7.High.Last(t_ind); All_28Pair_HiLo_Price[l, i, 13] = temp_7.Low.Last(t_ind); } //END FOR i } // END FOR l } //END METHOD Load_28Pair_HiLo_Prices ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// Load_28Pair_Close_Prices /////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void Load_28Pair_Close_Prices() { //Print("Inside : -PREVIOUS- : Close AND HiLo Prices"); //double t_1; Symbol t_Symbol; string tstr_Symbol_Code; int t_ind; // LOOP FOR PREVIOUS PRICES : LP IS A GLOBAL VARIABLE TO SET THE LOOP LIMIT for (int l = 0; l < LP1; l++) { t_ind = LP1_Array_Close[l]; //LOOP FOR 28 PAIRS for (int i = 0; i < 28; i++) { // GET SYMBOL t_Symbol = Get_28Pair_Symbol(i); tstr_Symbol_Code = t_Symbol.Code.ToString(); //GET 5-MIN OPEN PRICES FOR THE SYMBOL var temp_1 = MarketData.GetSeries(tstr_Symbol_Code, TF_5min); //GET 15-MIN OPEN PRICES FOR THE SYMBOL var temp_2 = MarketData.GetSeries(tstr_Symbol_Code, TF_15min); //GET 1-HOUR OPEN PRICES FOR THE SYMBOL var temp_3 = MarketData.GetSeries(tstr_Symbol_Code, TF_1Hr); //GET 4-hOUR OPEN PRICES FOR THE SYMBOL var temp_4 = MarketData.GetSeries(tstr_Symbol_Code, TF_4Hr); //GET DAILY OPEN PRICES FOR THE SYMBOL var temp_5 = MarketData.GetSeries(tstr_Symbol_Code, TF_D); //GET Weekly OPEN PRICES FOR THE SYMBOL var temp_6 = MarketData.GetSeries(tstr_Symbol_Code, TF_Wk); //GET Monthly OPEN PRICES FOR THE SYMBOL var temp_7 = MarketData.GetSeries(tstr_Symbol_Code, TF_Mt); // ----------- CLOSE PRICES // 5-MIN All_28Pair_Close_Price[l, i, 0] = temp_1.Close.Last(t_ind); // 15-MIN All_28Pair_Close_Price[l, i, 1] = temp_2.Close.Last(t_ind); // 1-HOUR All_28Pair_Close_Price[l, i, 2] = temp_3.Close.Last(t_ind); // 4-HOUR All_28Pair_Close_Price[l, i, 3] = temp_4.Close.Last(t_ind); // DAILY All_28Pair_Close_Price[l, i, 4] = temp_5.Close.Last(t_ind); // WEEKLY All_28Pair_Close_Price[l, i, 5] = temp_6.Close.Last(t_ind); // MONTHLY All_28Pair_Close_Price[l, i, 6] = temp_7.Close.Last(t_ind); } //END FOR i } // END FOR l } //END METHOD Load_28Pair_Close_Prices ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// Load_28Pair_Open_Prices /////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void Load_28Pair_Open_Prices() { //Print("Inside : CURRENT : Load 28Pair Open Prices"); Symbol t_Symbol; string tstr_Symbol_Code; int t_ind; // LOOP FOR PREVIOUS PRICES : LP IS A GLOBAL VARIABLE TO SET THE LOOP LIMIT for (int l = 0; l < LP1; l++) { t_ind = LP1_Array_Open[l]; for (int i = 0; i < 28; i++) { // GET SYMBOL t_Symbol = Get_28Pair_Symbol(i); tstr_Symbol_Code = t_Symbol.Code.ToString(); //GET 5-MIN OPEN PRICES FOR THE SYMBOL var temp_1 = MarketData.GetSeries(tstr_Symbol_Code, TF_5min); //GET 15-MIN OPEN PRICES FOR THE SYMBOL var temp_2 = MarketData.GetSeries(tstr_Symbol_Code, TF_15min); //GET 1-HOUR OPEN PRICES FOR THE SYMBOL var temp_3 = MarketData.GetSeries(tstr_Symbol_Code, TF_1Hr); //GET 4-hOUR OPEN PRICES FOR THE SYMBOL var temp_4 = MarketData.GetSeries(tstr_Symbol_Code, TF_4Hr); //GET DAILY OPEN PRICES FOR THE SYMBOL var temp_5 = MarketData.GetSeries(tstr_Symbol_Code, TF_D); //GET Weekly OPEN PRICES FOR THE SYMBOL var temp_6 = MarketData.GetSeries(tstr_Symbol_Code, TF_Wk); //GET Monthly OPEN PRICES FOR THE SYMBOL var temp_7 = MarketData.GetSeries(tstr_Symbol_Code, TF_Mt); /// ----------- OPEN PRICES // 5-MIN All_28Pair_Open_Price[l, i, 0] = temp_1.Open.Last(t_ind); // 15-MIN All_28Pair_Open_Price[l, i, 1] = temp_2.Open.Last(t_ind); // 1-HOUR All_28Pair_Open_Price[l, i, 2] = temp_3.Open.Last(t_ind); // 4-HOUR All_28Pair_Open_Price[l, i, 3] = temp_4.Open.Last(t_ind); // DAILY All_28Pair_Open_Price[l, i, 4] = temp_5.Open.Last(t_ind); // WEEKLY All_28Pair_Open_Price[l, i, 5] = temp_6.Open.Last(t_ind); // MONTHLY All_28Pair_Open_Price[l, i, 6] = temp_7.Open.Last(t_ind); } //END FOR i //Print("LP1 INDEX VALUE = " + t_ind); } // END FOR l } //END METHOD Load_28Pair_Open_Prices ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// OnSTART_Load_28Pair_Open_Prices /////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void OnSTART_Load_28Pair_Open_Prices() { Print("Inside : FIRST TIME ONLY : GET 28-PAIR OPEN PRICES ON START"); Symbol t_Symbol; string tstr_Symbol_Code; double t_1; // GET 5 PAIRS OPEN PRICES for (int i = 0; i < 28; i++) { // GET SYMBOL t_Symbol = Get_28Pair_Symbol(i); tstr_Symbol_Code = t_Symbol.Code.ToString(); //GET 5-MIN OPEN PRICES FOR THE SYMBOL var temp_1 = MarketData.GetSeries(tstr_Symbol_Code, TF_5min); //GET 15-MIN OPEN PRICES FOR THE SYMBOL var temp_2 = MarketData.GetSeries(tstr_Symbol_Code, TF_15min); //GET 1-HOUR OPEN PRICES FOR THE SYMBOL var temp_3 = MarketData.GetSeries(tstr_Symbol_Code, TF_1Hr); //GET 4-hOUR OPEN PRICES FOR THE SYMBOL var temp_4 = MarketData.GetSeries(tstr_Symbol_Code, TF_4Hr); //GET DAILY OPEN PRICES FOR THE SYMBOL var temp_5 = MarketData.GetSeries(tstr_Symbol_Code, TF_D); //GET Weekly OPEN PRICES FOR THE SYMBOL var temp_6 = MarketData.GetSeries(tstr_Symbol_Code, TF_Wk); //GET Monthly OPEN PRICES FOR THE SYMBOL var temp_7 = MarketData.GetSeries(tstr_Symbol_Code, TF_Mt); /// ----------- OPEN PRICES // 5-MIN t_1 = temp_1.Open.LastValue; // 15-MIN t_1 = temp_2.Open.LastValue; // 1-HOUR t_1 = temp_3.Open.LastValue; // 4-HOUR t_1 = temp_4.Open.LastValue; // DAILY t_1 = temp_5.Open.LastValue; // WEEKLY t_1 = temp_6.Open.LastValue; // MONTHLY t_1 = temp_7.Open.LastValue; Print(i + ". " + tstr_Symbol_Code + " = " + t_1); } //END FOR i } //END METHOD OnSTART_Load_28Pair_Open_Prices ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// Load_28Pair_PipSize /////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void Load_28Pair_PipSize() { Print("Inside : Load 28Pair Pip-Size"); Symbol t_Symbol; // LOOP FOR 28 PAIRS for (int i = 0; i < 28; i++) { // GET SYMBOL t_Symbol = Get_28Pair_Symbol(i); All_28Pair_Pip_Size[i] = t_Symbol.PipSize; } //END FOR } //END METHOD Load_28Pair_PipSize ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// Load_28Pair_SymbolCode /////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void Load_28Pair_SymbolCode() { Print("Inside : Load 28Pair Symbol-Code"); string tstr_Symbol_Code; Symbol t_Symbol; // LOOP FOR 28 PAIRS for (int i = 0; i < 28; i++) { // GET SYMBOL t_Symbol = Get_28Pair_Symbol(i); tstr_Symbol_Code = t_Symbol.Code.ToString(); All_28Pair_Symbol_Code[i] = tstr_Symbol_Code; } //END FOR } //END METHOD Load_28Pair_SymbolCode ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// CLOSE ALL PENDING ORDERS /////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //CLOSE-ALL PENDING-ORDERS OF THE LABEL DEFINED IN (t_Label) private void CloseAll_PendingOrders(string t_Label) { //Print Message and SERVER Date Time to Log files string tempText1 = string.Format("{0:ddd-d-MMM-y,h:mm tt}", Server.Time); //Print("Close-Selected ''Pending-Orders''. Server Date & Time = " + tempText1 + ",----> P-Order Label : " + t_Label); foreach (var pen in PendingOrders) { if (pen.Label == t_Label) { CancelPendingOrder(pen); } //END IF } //END FOR_EACH } //END METHOD CLOSE_ALL_Pending_Orders //////////////////////////////////////////////////////////////////////////////////////////// //CLOSE-ALL PENDING-ORDERS IRRESPECTIVE OF THE LABEL private void CloseAll_PendingOrders() { foreach (var pen in PendingOrders) { CancelPendingOrderAsync(pen); } //END FOR-EACH } //END METHOD CloseAll_PendingOrders ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// CLOSE ALL POSITIONS /////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //CLOSE-ALL TRADES OF THE LABEL DEFINED IN (t_Label) private void CloseAll_Positions(string t_Label) { //Print Message and Date Time to Log files string tempText1 = string.Format("{0:ddd-d-MMM-y,h:mm tt}", Server.Time); //Print("Close-Selected ''Running-Positions''. Server Date & Time = " + tempText1 + ",----> Running Position Label : " + t_Label); foreach (var pos in Positions) { if (pos.Label == t_Label) { ClosePosition(pos); } //END IF } //END FOR_EACH } //END METHOD CLOSE_ALL_Open_Position //////////////////////////////////////////////////////////////////////////////////////////// //CLOSE-ALL POSITIVE OR NEGATIVE TRADES IRRESPECTIVE OF THE LABEL private void CloseAll_Positions(bool Flag_Profit_Loss) { foreach (var pen in Positions) { //CLOSE ALL PROFITABLE TRADE if (Flag_Profit_Loss) if (pen.NetProfit >= 0) ClosePositionAsync(pen); //CLOSE ALL LOSS TRADE if (!Flag_Profit_Loss) if (pen.NetProfit <= 0) ClosePositionAsync(pen); } //END FOR-EACH } //END METHOD CloseAll_Positions //////////////////////////////////////////////////////////////////////////////////////////// //CLOSE PROFITABLE OR NEGATIVE TRADE THAT ARE ABOVE/BELOW THE TARGET VALUE (t_Target) private void CloseAll_Positions(int t_Target) { foreach (var pen in Positions) { //IF POSITIVE VALUE : CLOSE ALL GREATER THEN TARGET PRICE if (t_Target >= 0) if (pen.NetProfit >= t_Target) ClosePositionAsync(pen); //IF NEGATIVE VALUE : CLOSE ALL LESS THEN THE TARGET PRICE if (t_Target < 0) if (pen.NetProfit <= t_Target) ClosePositionAsync(pen); } //END FOR-EACH } //END METHOD CloseAll_Positions //////////////////////////////////////////////////////////////////////////////////////////// //CLOSE TRADE WITH DEFINED LABEL (t_str1) AND THOSE THAT ARE ABOVE/BELOW THE TARGET VALUE (t_Target ) private void CloseAll_Positions(string t_str1, int t_Target) { foreach (var pen in Positions) { //IF POSITIVE VALUE if (t_Target >= 0) if ((pen.Label == t_str1) && (pen.NetProfit >= t_Target)) ClosePositionAsync(pen); //IF NEGATIVE VALUE if (t_Target < 0) if ((pen.Label == t_str1) && (pen.NetProfit <= t_Target)) ClosePositionAsync(pen); } //END FOR-EACH } //END METHOD CloseAll_Positions ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// WRITE CANDLE DATA TO CSV FILE /////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void Write_To_CSV_File() { //>>>>>>>>>>>>>>>>>>>>>> //THIS FUNCTION WILL WRITE ALL THE DATA TO CSV FILE //>>>>>>>>>>>>>>>>>>>>>> //////////////////////////////////////// /// WRITE DATA TO CSV FILE /////// //////////////////////////////////////// if (p_Flag_Create_CSV_File) { //WRITE CURRENT DATA File_Writer.WriteLine(Concate_With_Comma()); } //END IF } //End METHOD Write_To_CSV_File ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// ADD COMMA TO THE STRING FUNCITON ////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private string Concate_With_Comma(params object[] parameters) { return string.Join(",", parameters.Select(p => p.ToString())); } //End METHOD CONCAT_WITH_COMMA ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// CREATE CSV FILE /////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void Create_CSV_File() { Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; //Server Time Recod string str_temp1 = string.Format("{0:ddd-d-MMM-y}", Server.Time); //Desktop Folder PATH and NAME str_DesktopFolder = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); str_FolderPath = Path.Combine(str_DesktopFolder, p_str_Folder_Name); //Create Directory and make the file name Directory.CreateDirectory(str_FolderPath); str_FileName = Path.Combine(str_FolderPath, Symbol.Code + " " + TimeFrame + " " + str_temp1 + ".csv"); //Print("File Path : " + str_FilePath); //Create or OVER RIDE Existing FILE and then Close it which is a must. File_Stream = File.Create(str_FileName); File_Stream.Close(); //Open File to prevent .NET from locking it and preventing access by other processes File_Stream = File.Open(str_FileName, FileMode.Open, FileAccess.Write, FileShare.ReadWrite); //Seek End of File to write File_Stream.Seek(0, SeekOrigin.End); //File Writer Stream to be created. File_Writer = new System.IO.StreamWriter(File_Stream, System.Text.Encoding.UTF8, 1); //Auto Flush to improve IO performance File_Writer.AutoFlush = true; } //End METHOD Create_CSV_File ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// ON STOP /////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// protected override void OnStop() { string temp_Text = string.Format("{0:ddd-d-MMM-y,h:mm tt}", Server.Time); Print("cBOT ''onStop'' Stop Date & time : " + temp_Text); //////////////////////////////////////// /// WRITE DATA TO CSV FILE /////// //////////////////////////////////////// if (p_Flag_Create_CSV_File) { File_Writer.WriteLine(Concate_With_Comma()); } //END IF //BLANK LINE Print(""); } //END METHOD On_STOP ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// Get_28Pair_Symbol /////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private Symbol Get_28Pair_Symbol(int t_Pair) { switch (t_Pair) { ////////////////////////////////////////////// /// JPY PAIRS x 7 ////////////////////////////////////////////// case 0: return MarketData.GetSymbol("GBPJPY"); break; case 1: return MarketData.GetSymbol("USDJPY"); break; case 2: return MarketData.GetSymbol("CADJPY"); break; case 3: return MarketData.GetSymbol("AUDJPY"); break; case 4: return MarketData.GetSymbol("NZDJPY"); break; case 5: return MarketData.GetSymbol("EURJPY"); break; case 6: return MarketData.GetSymbol("CHFJPY"); break; ////////////////////////////////////////////// /// EUR PAIRS x 6 ////////////////////////////////////////////// case 7: return MarketData.GetSymbol("EURNZD"); break; case 8: return MarketData.GetSymbol("EURCAD"); break; case 9: return MarketData.GetSymbol("EURAUD"); break; case 10: return MarketData.GetSymbol("EURUSD"); break; case 11: return MarketData.GetSymbol("EURGBP"); break; case 12: return MarketData.GetSymbol("EURCHF"); break; ////////////////////////////////////////////// /// GBP PAIRS x 5 ////////////////////////////////////////////// case 13: return MarketData.GetSymbol("GBPNZD"); break; case 14: return MarketData.GetSymbol("GBPAUD"); break; case 15: return MarketData.GetSymbol("GBPCAD"); break; case 16: return MarketData.GetSymbol("GBPCHF"); break; case 17: return MarketData.GetSymbol("GBPUSD"); break; ////////////////////////////////////////////// /// AUD PAIRS x 4 ////////////////////////////////////////////// case 18: return MarketData.GetSymbol("AUDUSD"); break; case 19: return MarketData.GetSymbol("AUDCHF"); break; case 20: return MarketData.GetSymbol("AUDNZD"); break; case 21: return MarketData.GetSymbol("AUDCAD"); break; ////////////////////////////////////////////// /// NZD PAIRS x 5 ////////////////////////////////////////////// case 22: return MarketData.GetSymbol("NZDCHF"); break; case 23: return MarketData.GetSymbol("NZDUSD"); break; case 24: return MarketData.GetSymbol("NZDCAD"); break; ////////////////////////////////////////////// /// USD PAIRS x 2 ////////////////////////////////////////////// case 25: return MarketData.GetSymbol("USDCAD"); break; case 26: return MarketData.GetSymbol("USDCHF"); break; ////////////////////////////////////////////// /// CAD PAIRS x 1 ////////////////////////////////////////////// case 27: return MarketData.GetSymbol("CADCHF"); break; } //SWITCH return Symbol; } //END METHOD Get_Pair_Symbol ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// Set the Count Bar Value for Market Series Function ////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void Set_Count_Bar_Value() { Count_Bar = MarketSeries.Close.Count - 1; //Daily_Count_Bar = 1; //Print("Count_Bar Value = " + Count_Bar + ", Daily_Count_Bar = " + Daily_Count_Bar); //Print(""); } //End METHOD Set_Count_Bar_Value //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// SET TEXT, TAB AND NEXT LINE SETTING /////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void Draw_OnChart_C1(string t_PreFix, int Line_No, int Tab_Pos, string t_text, Colors Draw_Color) { //CREATE A UNIQUE OBJECT NAME FOR THE METHOD ChartObjects.DrawText string tstr_1 = ""; tstr_1 = t_PreFix + Line_No.ToString() + Tab_Pos.ToString(); ChartObjects.DrawText(tstr_1, my_NL(Line_No) + my_Tabs(Tab_Pos) + t_text, StaticPosition.TopLeft, Draw_Color); } //END METHOD //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// static string my_Tabs(int n) { return new String('\t', n); } //END METHOD my_Tabs //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// static string my_NL(int n) { return new String('\n', n); } //END METHOD my_NL //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void Create_Fixed_Display_1() { //int c1 = 0, c2 = 0; // c3 = 0, c4 = 0, c5 = 0, c6 = 0, c7 = 0, c8 = 0, c9 = 0; //int r1 = 0; // r2 = 0, r3 = 0, r4 = 0, r5 = 0, r6 = 0, r7 = 0, r8 = 0, r9 = 0; //Heading # 1 //r1 = 1; //c1 = 3; //ChartObjects.DrawText("a00", my_NL(r1 + 0) + my_Tabs(c1) + "Line 1", StaticPosition.TopLeft, Colors.Yellow); //Heading # 2 //c2 = c1 + 1; //ChartObjects.DrawText("b00", my_NL(r1 + 0) + my_Tabs(c2) + "Line 1", StaticPosition.TopLeft, Colors.Yellow); } //END METHOD Create_Fixed_Display_1 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void Create_Fixed_Display_2() { //int c1 = 0, c2 = 0, c3 = 0, c4 = 0, c5 = 0, c6 = 0, c7 = 0, c8 = 0, c9 = 0; //int r1 = 0, r2 = 0, r3 = 0, r4 = 0, r5 = 0, r6 = 0, r7 = 0, r8 = 0, r9 = 0; } //END METHOD Create_Fixed_Display_2 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void Create_Display_RowColumn() { //int r1, c1; string t_text = ""; // DISPLAY LINE # for (int i = 0; i <= 80; i++) { t_text = i.ToString(); Draw_OnChart_C1("Line", i, 0, t_text, Clr_Bk_1); } //END FOR // DISPLAY LINE # for (int i = 0; i <= 50; i++) { t_text = "C#"; t_text = t_text + "." + i.ToString(); Draw_OnChart_C1("Line", 0, (i), t_text, Clr_Bk_1); } //END FOR } //END METHOD Create_Display_RowColumn ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void Display_Vertical_Lines(int t_Start_Line, int t_Stop_Line, int t_Col) { //FIRST LOOP for (int i = t_Start_Line; i < t_Stop_Line; i++) { Draw_OnChart_C1("VL" + i.ToString(), i, t_Col, " ||", Clr_Border); } //END FOR } //END FUNCTION Display_Major_Flag_Values ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void Display_Horizontal_Lines(int t_Line, int t_Start_Col, int t_Stop_Col) { //FIRST LOOP for (int i = t_Start_Col; i < t_Stop_Col; i++) { Draw_OnChart_C1("VL" + i.ToString(), t_Line, i, "=======", Clr_Border); } //END FOR } //END FUNCTION Display_Major_Flag_Values ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// Declare_All_Arrays /////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void Declare_All_Arrays() { // ATR VALUES (IN PIPS) ---------------------------------- All_28Pair_ATR_Value = new double[LP1, 28, 7]; GTotal_28Pair_ATR_Value = new double[LP1, 7]; All_MajorPair_ATR_Value = new double[LP1, 8, 7]; GTotal_MajorPair_ATR_Value = new double[LP1, 7]; // 28-PAIRS ---------------------------------------------- All_28Pair_Pip_Size = new double[28]; All_28Pair_Symbol_Code = new string[28]; // 8-MAJOR PAIRS ----------------------------------------- // MAJOR PAIR RELATED VARIABLES MajorPair_Headings = new string[8]; MajorPair_Combo = new string[8, 7]; Base_Currency = new int[8, 7]; // CURRENT PRICES ---------------------------------------- // LP1 IS THE HISTORY OF PREVIOUS PRICES. // 28 PAirs, 7 TimeFrames (5min, 15min, .....) All_28Pair_Open_Price = new double[LP1, 28, 7]; All_28Pair_Close_Price = new double[LP1, 28, 7]; All_28Pair_HiLo_Price = new double[LP1, 28, 14]; // TOTAL PIPS -------------------------------------------- All_28Pair_Total_Pips = new double[LP1, 28, 7]; GTotal_28Pair_Total_Pips = new double[LP1, 7]; All_MajorPair_Total_Pips = new double[LP1, 8, 7]; GTotal_MajorPair_Total_Pips = new double[LP1, 7]; Sorted_MajorPair_Monthly_Total_Pips = new int[LP1, 8]; Sorted_MajorPair_Weekly_Total_Pips = new int[LP1, 8]; Sorted_MajorPair_Daily_Total_Pips = new int[LP1, 8]; Sorted_MajorPair_4Hour_Total_Pips = new int[LP1, 8]; Sorted_MajorPair_Hourly_Total_Pips = new int[LP1, 8]; Sorted_MajorPair_15min_Total_Pips = new int[LP1, 8]; // NAMES OF THE MONTH Month_Name = new string[12]; // CONTAINS THE INDEX VALUES TO ACCESS PRICES // CURRENT YEAR LP1_Array_Open = new int[LP1]; LP1_Array_Close = new int[LP1]; LP1_TF_Name = new string[LP1]; // AVERAGE PIPS -------------------------------------------- Avg_All_28Pair_Total_Pips = new double[28, 7]; Avg_All_MajorPair_Total_Pips = new double[8, 7]; // KEEP TRACK OF 8-MAJOR PAIR, IF TOTAL PIPS HAVE // CROSSED AVG.PIPS, IN ALL 7 TIME FRAMES Flag_TotalPips_Greater_AvgPips = new int[8]; DateTime_TotalPips_Greater_AvgPips = new string[8]; } //END METHOD Declare_All_Arrays ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //// Initialize_Array_OnStart_Only /////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void Initialize_Array_OnStart_Only() { //INITIALIZATION OF MAJOR PAIR NAMES MajorPair_Headings[0] = "EUR-PAIRS"; MajorPair_Headings[1] = "GBP-PAIRS"; MajorPair_Headings[2] = "USD-PAIRS"; MajorPair_Headings[3] = "JPY-PAIRS"; MajorPair_Headings[4] = "CHF-PAIRS"; MajorPair_Headings[5] = "CAD-PAIRS"; MajorPair_Headings[6] = "AUD-PAIRS"; MajorPair_Headings[7] = "NZD-PAIRS"; // 0-EURO PAIRS MajorPair_Combo[0, 0] = "EURUSD"; MajorPair_Combo[0, 1] = "EURJPY"; MajorPair_Combo[0, 2] = "EURGBP"; MajorPair_Combo[0, 3] = "EURAUD"; MajorPair_Combo[0, 4] = "EURNZD"; MajorPair_Combo[0, 5] = "EURCHF"; MajorPair_Combo[0, 6] = "EURCAD"; Base_Currency[0, 0] = 1; Base_Currency[0, 1] = 1; Base_Currency[0, 2] = 1; Base_Currency[0, 3] = 1; Base_Currency[0, 4] = 1; Base_Currency[0, 5] = 1; Base_Currency[0, 6] = 1; // 1-GBP PAIRS MajorPair_Combo[1, 0] = "GBPUSD"; MajorPair_Combo[1, 1] = "GBPJPY"; MajorPair_Combo[1, 2] = "EURGBP"; MajorPair_Combo[1, 3] = "GBPAUD"; MajorPair_Combo[1, 4] = "GBPNZD"; MajorPair_Combo[1, 5] = "GBPCHF"; MajorPair_Combo[1, 6] = "GBPCAD"; Base_Currency[1, 0] = 1; Base_Currency[1, 1] = 1; Base_Currency[1, 2] = -1; Base_Currency[1, 3] = 1; Base_Currency[1, 4] = 1; Base_Currency[1, 5] = 1; Base_Currency[1, 6] = 1; // 2-USD PAIRS MajorPair_Combo[2, 0] = "EURUSD"; MajorPair_Combo[2, 1] = "GBPUSD"; MajorPair_Combo[2, 2] = "AUDUSD"; MajorPair_Combo[2, 3] = "NZDUSD"; MajorPair_Combo[2, 4] = "USDJPY"; MajorPair_Combo[2, 5] = "USDCHF"; MajorPair_Combo[2, 6] = "USDCAD"; Base_Currency[2, 0] = -1; Base_Currency[2, 1] = -1; Base_Currency[2, 2] = -1; Base_Currency[2, 3] = -1; Base_Currency[2, 4] = 1; Base_Currency[2, 5] = 1; Base_Currency[2, 6] = 1; // 3-JPY PAIRS MajorPair_Combo[3, 0] = "EURJPY"; MajorPair_Combo[3, 1] = "USDJPY"; MajorPair_Combo[3, 2] = "GBPJPY"; MajorPair_Combo[3, 3] = "AUDJPY"; MajorPair_Combo[3, 4] = "NZDJPY"; MajorPair_Combo[3, 5] = "CHFJPY"; MajorPair_Combo[3, 6] = "CADJPY"; Base_Currency[3, 0] = -1; Base_Currency[3, 1] = -1; Base_Currency[3, 2] = -1; Base_Currency[3, 3] = -1; Base_Currency[3, 4] = -1; Base_Currency[3, 5] = -1; Base_Currency[3, 6] = -1; // 4-CHF PAIRS MajorPair_Combo[4, 0] = "EURCHF"; MajorPair_Combo[4, 1] = "USDCHF"; MajorPair_Combo[4, 2] = "GBPCHF"; MajorPair_Combo[4, 3] = "AUDCHF"; MajorPair_Combo[4, 4] = "NZDCHF"; MajorPair_Combo[4, 5] = "CADCHF"; MajorPair_Combo[4, 6] = "CHFJPY"; Base_Currency[4, 0] = -1; Base_Currency[4, 1] = -1; Base_Currency[4, 2] = -1; Base_Currency[4, 3] = -1; Base_Currency[4, 4] = -1; Base_Currency[4, 5] = -1; Base_Currency[4, 6] = 1; // 5-CAD PAIRS MajorPair_Combo[5, 0] = "EURCAD"; MajorPair_Combo[5, 1] = "USDCAD"; MajorPair_Combo[5, 2] = "GBPCAD"; MajorPair_Combo[5, 3] = "AUDCAD"; MajorPair_Combo[5, 4] = "NZDCAD"; MajorPair_Combo[5, 5] = "CADCHF"; MajorPair_Combo[5, 6] = "CADJPY"; Base_Currency[5, 0] = -1; Base_Currency[5, 1] = -1; Base_Currency[5, 2] = -1; Base_Currency[5, 3] = -1; Base_Currency[5, 4] = -1; Base_Currency[5, 5] = 1; Base_Currency[5, 6] = 1; // 6-AUD PAIRS MajorPair_Combo[6, 0] = "EURAUD"; MajorPair_Combo[6, 1] = "GBPAUD"; MajorPair_Combo[6, 2] = "AUDUSD"; MajorPair_Combo[6, 3] = "AUDJPY"; MajorPair_Combo[6, 4] = "AUDNZD"; MajorPair_Combo[6, 5] = "AUDCHF"; MajorPair_Combo[6, 6] = "AUDCAD"; Base_Currency[6, 0] = -1; Base_Currency[6, 1] = -1; Base_Currency[6, 2] = 1; Base_Currency[6, 3] = 1; Base_Currency[6, 4] = 1; Base_Currency[6, 5] = 1; Base_Currency[6, 6] = 1; // 7-NZD PAIRS MajorPair_Combo[7, 0] = "EURNZD"; MajorPair_Combo[7, 1] = "GBPNZD"; MajorPair_Combo[7, 2] = "AUDNZD"; MajorPair_Combo[7, 3] = "NZDUSD"; MajorPair_Combo[7, 4] = "NZDJPY"; MajorPair_Combo[7, 5] = "NZDCHF"; MajorPair_Combo[7, 6] = "NZDCAD"; Base_Currency[7, 0] = -1; Base_Currency[7, 1] = -1; Base_Currency[7, 2] = -1; Base_Currency[7, 3] = 1; Base_Currency[7, 4] = 1; Base_Currency[7, 5] = 1; Base_Currency[7, 6] = 1; // NAME OF THE MONTHS Month_Name[0] = "1.Jan"; Month_Name[1] = "2.Feb"; Month_Name[2] = "3.Mar"; Month_Name[3] = "4.Apr"; Month_Name[4] = "5.May"; Month_Name[5] = "6.June"; Month_Name[6] = "7.Jul"; Month_Name[7] = "8.Aug"; Month_Name[8] = "9.Sep"; Month_Name[9] = "10.Oct"; Month_Name[10] = "11.Nov"; Month_Name[11] = "12.Dec"; //--------------------------------------------------- // CURRENT MONTH : OPEN AND CLOSE PRICES LP1_Array_Open[0] = 0; LP1_Array_Close[0] = 0; // INITIALIZE THE INDEX FOR ACCESSING PRICES for (int i = 1; i < LP1; i++) { LP1_Array_Open[i] = i; } //END FOR for (int i = 1; i < LP1; i++) { LP1_Array_Close[i] = i; } //END FOR LP1_TF_Name[0] = "Current"; for (int i = 1; i < LP1; i++) { LP1_TF_Name[i] = "Prev-" + i.ToString(); } //END FOR //--------------------------------------------------- } //END METHOD Initialize_Array_OnStart_Only } //END OF MAIN PUBLIC CLASS } //END OF MAIN cALGO ROBOT  
free  05 Jul 2017
Hi, This cBOT will display 8-Major Pair Strength (in Pips) in different time frames, sorted.  Basically, it helps in knowing 1. how the Pairs are behaving in group and 2. which are the two opposite Major Pairs and 3. is it wise to trade or not.   4. It is best to trade the two extreme Pairs on Daily or 4Hr Time Frame (when London or US session opens). APLLY cBOT on : 1-min TIME FRAME WAITING :  DUE TO cTRADER internal issue; First TIME OPEN PRICE Loading takes time. so be patient. around 4 to 5 mins. then once loaded, it updates the prices within mili-seconds on each minute. Please give me your feedback on what other features can be displayed.  (inside the code, there is a code of individual 28 pairs that can be used to display the individual pairs also. have disabled it). Thank you ! /// Saleem Khan