Description
(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
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
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.WEuropeStandardTime, AccessRights = AccessRights.FullAccess)]
public class SK1_Volatality_28Pairs : Robot
{
////////////////////////////////////////////////////////////////////////////
////---- USER INPUT ----////////////////////////////
////////////////////////////////////////////////////////////////////////////
//////-------------------------------------------------------
//////-------------------------------------------------------
[Parameter(">>>>>>> CBOT : 28-Pair Volatility <<<<<<<")]
public string t_cBOTNAME2 { get; set; }
//////-------------------------------------------------------
//////-------------------------------------------------------
[Parameter(">>>>>>> C#1. ENTRY CRITERIA <<<<<<<")]
public string t_EC_Msg001 { get; set; }
[Parameter("0. Manual(1) or Auto Start(0) : ", DefaultValue = "0", MinValue = 0, MaxValue = 1)]
public int p_Manually_Start { get; set; }
//----------
//////-------------------------------------------------------
//////-------------------------------------------------------
[Parameter(">>>>>>> C#2. MANAGE TRADES <<<<<<<<")]
public string t_MT_Msg001 { get; set; }
[Parameter("1a. Scale-IN - ON(1), OFF(0)", DefaultValue = 1, MinValue = 0, MaxValue = 1)]
public int p_SCALE_IN_ON_OFF { get; set; }
//----------
[Parameter("2a. No of Max. Pos to Open", DefaultValue = 6, MinValue = 0, MaxValue = 20)]
public int p_SI_Max_No_of_Pos { get; set; }
//----------
[Parameter("3a. TRAILING STOP LOSS - ON(1), OFF(0)", DefaultValue = 1, MinValue = 0, MaxValue = 1)]
public int p_Trailing_SL_ON_OFF { get; set; }
//----------
[Parameter("4a. PIPS BREAK-EVEN - ON(1), OFF(0)", DefaultValue = 1, MinValue = 0, MaxValue = 1)]
public int p_Break_Even_SL_ON_OFF { get; set; }
//////-------------------------------------------------------
//////-------------------------------------------------------
[Parameter(">>>>>>> C#4. CONTROL STRATEGIES <<<<<<<")]
public string t_Msg_10 { get; set; }
[Parameter("1. Max. No of Positions to be opened : ", DefaultValue = 20, MinValue = 10, MaxValue = 100)]
public int p_Max_No_of_Positions_to_Open { get; set; }
//----------
//////-------------------------------------------------------
//////-------------------------------------------------------
[Parameter(">>>>>>> SETTINGS BUY SELL VOL <<<<<<<")]
public string temp01 { get; set; }
//////-------------------------------------------------------
//////-------------------------------------------------------
[Parameter(">>>>>>> C#3. EXIT STRATEGIES <<<<<<<")]
public string t_ES_Msg001 { get; set; }
[Parameter("1a. Equity Manager (0)No, (1)Yes", DefaultValue = 1, MinValue = 0, MaxValue = 1)]
public int p_Equity_Manager { get; set; }
[Parameter("2a. (Single Pair) PROFIT Lock_IN (0)No, (1)Yes", DefaultValue = 1, MinValue = 0, MaxValue = 1)]
public int p_LOCK_IN_PORIFT_ON_OFF { get; set; }
[Parameter("3a. Close Single Pair, if Target NET PL Reached. ON(1), OFF(0)", DefaultValue = 1, MinValue = 0, MaxValue = 1)]
public int p_Target_NETPL_ON_OFF { get; set; }
//----------
//////-------------------------------------------------------
//////-------------------------------------------------------
[Parameter(">>>>>>> C#5. OTHER SETTINGS <<<<<<<")]
public string t_OS_Msg001 { get; set; }
//----------
[Parameter("1. Timer Sec", DefaultValue = 5, MinValue = 0)]
public int p_TimerSec { get; set; }
[Parameter("2. Volitality, Time Frame", DefaultValue = "Minute15")]
public TimeFrame p_Volitality_TF_01 { get; set; }
[Parameter("3. ATR, Time Frame", DefaultValue = "Hour4")]
public TimeFrame p_ATR_TF_01 { get; set; }
[Parameter("4. ATR, Period", DefaultValue = 4, MinValue = 2, MaxValue = 300)]
public int p_ATR_Period { get; set; }
//////-------------------------------------------------------
//////-------------------------------------------------------
[Parameter(">>>> TRADING TIME BASED ON UTC +0 <<<<")]
public string t_TTBMsg001 { get; set; }
[Parameter("1. Enable Trading Time (1)ON, (0)OFF", DefaultValue = 1, MinValue = 0, Step = 1, MaxValue = 1)]
public int p_Trading_Time_ON_OFF { get; set; }
//////-------------------------------------------------------
//////-------------------------------------------------------
[Parameter(">>>>> ALERTS <<<<<")]
public string t_Msg0019 { get; set; }
[Parameter("1. Sound Alerts (1)ON, (0)OFF", DefaultValue = 0, MinValue = 0, Step = 1, MaxValue = 1)]
public int p_Sound_ALerts_ON_OFF { get; set; }
[Parameter("Media File", DefaultValue = "c:\\windows\\media\\ringout.wav")]
public string p_MediaFile { get; set; }
[Parameter("")]
public string t_Blan08 { get; set; }
////---- END OF USER INPUT ----////
////////////////////////////////////////////////////////////////////////////
////---- GLOBAL VARIABLES ----//////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
///----------------------------------------------------
///---- MARGIN LEVELS ----------------
///---- FOR NEW TRADES
private int p_Min_Margin_Level_01 = 1100;
///---- FOR ADDITIONAL TRADES
private int p_Min_Margin_Level_02 = 700;
///--- USED IN DISPLAYING MOVING STATUS
private int Count_Timer = 1;
///----------------------------------------------------
///---- DISPLAY FIX VALUES ----------------
int St_Line_No = 0, St_Col_No = 0;
////---- FOR MAJOR PAIRS LISTING ALL 56 PAIRS
private int Col_Offset = 8;
private int Line_Offset = 4;
///----------------------------------------------------
////---- COLORS --------------------------
private Colors Clr_Bk_1 = Colors.DimGray;
private Colors Clr_Heading_1 = Colors.LightPink;
private Colors Clr_Heading_2 = Colors.LightSeaGreen;
private Colors Clr_Heading_3 = Colors.Tomato;
private Colors Clr_PairListing = Colors.DarkOrange;
private Colors Clr_Positive = Colors.CornflowerBlue;
private Colors Clr_Negative = Colors.IndianRed;
private Colors Clr_True = Colors.LimeGreen;
private Colors Clr_False = Colors.Crimson;
private Colors Clr_Signal_Buy = Colors.CornflowerBlue;
private Colors Clr_Signal_Sell = Colors.Yellow;
private Colors Clr_Value_01 = Colors.DimGray;
private Colors Clr_Value_02 = Colors.AliceBlue;
private Colors Clr_Border_01 = Colors.LightGray;
private Colors Clr_Border_02 = Colors.SlateGray;
private Colors Clr_Signal_Hold = Colors.OrangeRed;
private Colors Clr_Signal_Ntrl = Colors.DimGray;
private Colors Clr_Warning = Colors.MediumVioletRed;
///----------------------------------------------------
///--- RECORD HOUR, DAY, WEEK, MONTH --------------
private int Hour_01 = 0;
private int Hour_02 = 0;
private int Day_01 = 0;
private int Day_02 = 0;
private int Week_01 = 0;
private int Week_02 = 0;
private int Month_01 = 0;
private int Month_02 = 0;
///----------------------------------------------------
///--- FLAG TO DISABLE TRADING --------------
private bool Flag_Trading_Till_Next_Hr = true;
private bool Flag_Trading_Till_Next_Dy = true;
private bool Flag_Trading_Till_Next_Wk = true;
///----------------------------------------------------
///--- FLAG ONE TIME -------------------
private bool Flag_One_Time_01 = false;
///----------------------------------------------------
///--- EXCLUSIVE METHOD CONTROL FLAGS ---------
private bool Flag_isExecuting_01 = false;
private bool Flag_isExecuting_02 = false;
private bool Flag_isExecuting_03 = false;
private bool Flag_isExecuting_04 = false;
private bool Flag_isExecuting_05 = false;
private bool Flag_isExecuting_06 = false;
private bool Flag_isExecuting_10 = false;
private bool Flag_isExecuting_11 = false;
private bool Flag_isExecuting_12 = false;
private bool Flag_isExecuting_13 = false;
private bool Flag_isExecuting_14 = false;
private bool Flag_isExecuting_20 = false;
private bool Flag_isExecuting_21 = false;
private bool Flag_isExecuting_22 = false;
private bool Flag_isExecuting_23 = false;
///----------------------------------------------------
///--- 8 MAJOR PAIRS : -----------------
private string[] MP_Main_Heading;
private string[,] MP_Sub_Heading;
private string[,] MajorP_of_28Pair;
private string[,] MajorPair_Symbol;
private int[,] Base_Currency;
///----------------------------------------------------
///--- 28 PAIRS : ----------------
private double[] All_28_Pair_Pip_Size;
private double[] All_28_Pair_Pip_Value;
private double[] All_28_Pair_Margin;
private string[] All_28_Pair_Symbol_Code;
private double[] All_28_Pair_Ask_Price;
private double[] All_28_Pair_Bid_Price;
///----------------------------------------------------
///--- A/C BALANCE AND EQUITY ----------------
private double Start_Equity = 0;
///----------------------------------------------------
///--- TODAY's DATE ----------------------
private string Todays_Date = "";
private bool Trading_Time = false;
///----------------------------------------------------
///--- POSITION DETAILS ---------------------
///--- LABELS
private string Label_1st_Buy = "1st_Buy";
//private string Label_Buy_SI = "Buy_SI";
private string Label_1st_Sell = "1st_Sell";
//private string Label_Sell_SI = "Sell_SI";
///--- PIP COST
private int Total_Account_Pos_Count = 0;
///--- FLAGS FOR A/C MARGINS
bool Flag_Acc_Margin_Level_01 = false;
bool Flag_Acc_Margin_Level_02 = false;
///--------------------------------------------------
///--- MARKET PRICES -------------------
MarketSeries[] MrktSries_Price_01_min;
MarketSeries[] MrktSries_Price_15min;
private double[] All_28_Pair_Daily_Candle_High_Price;
private double[] All_28_Pair_Daily_Candle_Low_Price;
private double[] All_28_Pair_Volitality;
private double[] All_28_Pair_15min_Pips;
private double[] All_28_Pair_Tick_Volume;
///--------------------------------------------------
///--- INDICATORS -------------------
///--- 28 PAIRS ATR
private AverageTrueRange[] Indi_ATR_28P_15mins;
private MarketSeries[] MrktSeries_ATR_15mins;
private double[] All_28P_ATR_Value_15mins;
///- 8 MAJOR PAIR TOTAL PIPS / ATR INDICATOR
MarketSeries[] MrktSries_Price_01_Hour;
MarketSeries[] MrktSries_Price_04_Hour;
private Indicators.MajorPair_Total_Pips_Single_Pair_ATR[] Indi_MP_ATR_1Hour;
private Indicators.MajorPair_Total_Pips_Single_Pair_ATR[] Indi_MP_ATR_4Hour;
private double[] All_28P_TPIPS_ATR_Val_Hour;
private double[] All_28P_TPIPS_ATR_Val_4Hour;
////---- 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,h:mm tt}", Server.Time);
Print("cBOT Start Date & Time : " + t_Date);
Print("");
/// INITIALIZE TIMER ON EVERY x SECONDS
Timer.Start(p_TimerSec);
///-------------------------------------------------------------------
///--- DISPLAY CBOT NAME and USER INPUT VALUES ON CHART ------------
Display_BOT_NAME();
Print("1/8 OnStart. Display User Input Values on Chart");
Display_Input_Values_OnChart();
///--------------------------------------------------
///--- SET THE LABEL OF THE CBOT ------------------
///---------------------------------------
///--- ARRAYS ------------------------
Print("2/8 OnStart. Declaring & Initializing Arrays");
Declare_All_Arrays();
Initialize_Array_OnStart_Only();
///---------------------------------------
///--- INITIALIZE INDICATORS ---------
Print("3/8 OnStart. Initializing INDICATORS");
Initialize_Indicators();
///-----------------------------------------------------------------
///--- RESET DATA ON START AND ON CHANGE OF TIME ---------------
Print("4/8 OnStart. Get Pos Count, Vol, PipCost and Resetting of Arrays to 0");
Get_Positions_Count_Volume_PipCost();
Reset_Arrays_on_Day_Change();
///---------------------------------------
///--- SET FEW DEFAULT VALUES --------
Print("5/8 OnStart. Set Few Default Values on Start of cBOT");
Set_Few_Default_Value_On_Start();
///---------------------------------------
///--- GET METHOD DATA ---------------
Print("6/8 OnStart. Call of Methods that will Run on Bar");
Update_Methods_Data_OnBAR();
///--- CALL ONCE THIS MEHTOD ON START
Print("7/8 OnStart. Update Values on Timer Function");
Upate_Dynamic_Values_On_Timer();
///--- DISPLAY ROW COL AND COLORS LIST ON CHARTS
Print("8/8 OnStart. Draw on Screen : Row, col, Colors, Table");
Display_RowColumn();
Display_Color_Test();
///--- WRITE DATA IN CSV FORMAT ---------
// if (p_Flag_Create_CSV_File == true)
// Write_To_CSV_File();
///--- DRAW TABLE
Display_TABLE();
///--- UPDATE WAIT FOR BUY OR SELL SIGNAL ---------
//OnStart_Change_in_ATR_Buy_Sell_Signal();
// ----------------------------------------------
}
//END METHOD OnStart()
////////////////////////////////////////////////////////////////////////////
////---- ON BAR ----////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
protected override void OnBar()
{
///--- METHOD EXCLUSIVE CONTROL FLAG
if (Flag_isExecuting_01 == false)
{
// SET THE FLAG
Flag_isExecuting_01 = true;
Print("OnBar. UPDATE METHODS DATA ON_BAR");
///-------------------------------
///--- GET METHOD DATA ---------
Update_Methods_Data_OnBAR();
///--- RESET THE FLAG
Flag_isExecuting_01 = false;
}
//END if (Flag_isExecuting_01 == false)
}
//END METHOD OnBar()
////////////////////////////////////////////////////////////////////////////
////---- ON TICK ----///////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
protected override void OnTick()
{
///--- METHOD EXCLUSIVE CONTROL FLAG
///--- ONBAR AND ONTICK DON'T EXECUTE TOGETHER
if (Flag_isExecuting_01 == false)
{
// METHOD EXCLUSIVE CONTROL FLAG ---------------------------
if (Flag_isExecuting_02 == false)
{
// SET THE FLAG
Flag_isExecuting_02 = true;
// RESET THE FLAG
Flag_isExecuting_02 = false;
}
//END if (Flag_isExecuting_02 == false)
}
//END IF
}
//END METHOD OnTick()
////////////////////////////////////////////////////////////////////////////
////---- ON TIMER ----/////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
protected override void OnTimer()
{
///--- METHOD EXCLUSIVE CONTROL FLAG
///--- ONBAR AND ONTIMER DON'T EXECUTE TOGETHER
if (Flag_isExecuting_01 == false)
{
// METHOD EXCLUSIVE CONTROL FLAG ---------------------------
if (Flag_isExecuting_03 == false)
{
// SET THE FLAG
Flag_isExecuting_03 = true;
///--- START REFRESHING / UPDATING
Draw_OnChart_C2("DBN134", 1, (1 + Count_Timer), Count_Timer.ToString() + "." + "Updating", Clr_True);
Print("OnTimer: Upate Dynamic Values On_Timer ");
///--- METHOD TO CALL OTHER METHODS
Upate_Dynamic_Values_On_Timer();
// INC THE COUNT
Count_Timer += 1;
// RESET THE FLAG
Flag_isExecuting_03 = false;
}
//END IF (Flag_isExecuting_03 == false)
}
//END IF
if (Count_Timer == 4)
Count_Timer = 1;
}
//End FUNCTION On_Timer
////////////////////////////////////////////////////////////////////////////
////---- ON STOP ----///////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
protected override void OnStop()
{
//BLANK LINE
Print("");
Print("Method : OnStop() '': Date & time : " + Server.Time);
}
//END METHOD OnStop()
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
////---- TEST_FUNCTION ----//////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
private void Test_Function()
{
// Put your core logic here
}
////---- END METHOD Test_Function()
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
////---- Display_28_Pair_Pairs_Name_01 ----////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
private void Display_28_Pair_Pairs_Name_01(int t_Row, int t_Col)
{
int t_Line_no = 0, t_Col_no = 0;
Colors t_Clr = Clr_Signal_Ntrl;
Symbol t_Symbol;
string tstr_Symbol_Code;
// COPY ROW COL POSITION
t_Line_no = t_Row;
t_Col_no = t_Col - 2;
//t_Offset = 2;
///--- TABLE HEADING
// HEADINGS ---------------------
Draw_OnChart_C1("D28PEV01", t_Line_no - 3, t_Col_no + 0, "", Clr_Value_01);
Draw_OnChart_C1("D28PEV01", t_Line_no - 2, t_Col_no + 0, "Pair", Clr_Heading_1);
Draw_OnChart_C1("D28PEV01", t_Line_no - 1, t_Col_no + 0, "Name", Clr_Heading_1);
//LOOP FOR 28 PAIRS
for (int i = 0; i < 28; i++)
{
t_Clr = Clr_Signal_Ntrl;
// GET SYMBOL
t_Symbol = Get_28Pair_Symbol(i);
tstr_Symbol_Code = t_Symbol.Code.ToString();
///--- SET THE COLOR
// PAIR NAME
Draw_OnChart_C1("D28PEV01", t_Line_no, t_Col_no + 0, (i + 1).ToString("0") + ". " + tstr_Symbol_Code, t_Clr);
///INC ROW
t_Line_no += 1;
///-- EXTRA ROW
if (i == 6 || i == 12 || i == 17 || i == 21 || i == 24)
t_Line_no += 1;
}
//END FOR
}
////---- END METHOD Display_28_Pair_Pairs_Name_01()
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
////---- Display_Heading_All_MajorPair_AND_Sub_Pair ----//////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
private void Display_Heading_All_MajorPair_AND_Sub_Pair(int t_Row, int t_Col)
{
int t_index = 0;
int t_Line_no = 0, t_Col_no = 0;
string tstr_Symbol_Code = "", tstr_Pair = "", tstr_MP = "";
// COPY ROW COL POSITION
t_Line_no = t_Row;
t_Col_no = t_Col;
//t_Offset = 2;
// LOOP FOR 8-MAJOR PAIRS
for (int i = 0; i < 8; i++)
{
// MAJOR PAIR NAME ABOVE 7-SUB PAIR NAMES
tstr_MP = MP_Main_Heading[i];
Draw_OnChart_C1("DH8MP01", t_Line_no - 1, t_Col_no, (i + 1).ToString("0") + "." + tstr_MP, Clr_Heading_2);
// LOOP FOR 7-TIME FRAME
for (int j = 0; j < 7; j++)
{
// GET PAIR SYMBOL CODE
tstr_Symbol_Code = MajorPair_Symbol[i, j];
// MEHTOD TO FIND THE SEARCH INDEX
t_index = Return_Pair_Index_Position(tstr_Symbol_Code);
//GET SUB-PAIR DISPLAY NAME
tstr_Pair = MP_Sub_Heading[i, j];
Draw_OnChart_C1("DH8MP01", t_Line_no, t_Col_no, tstr_Pair, Clr_PairListing);
///INC ROW
t_Line_no += 1;
}
//END FOR
Draw_OnChart_C1("DH8MP01", t_Line_no, t_Col_no + 1, "TOTAL", Clr_Heading_2);
///INC ROW
t_Line_no += Line_Offset;
// SHIFT COL AND RESET ROW
if (i == 3)
{
t_Col_no += Col_Offset;
t_Line_no = t_Row;
}
//END IF
}
//END FOR
}
////---- END METHOD Display_Heading_All_MajorPair_AND_Sub_Pair()
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
////---- Display_Volitatlity_and_ATR ----//////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
private void Display_Volitatlity_and_ATR(int t_Row, int t_Col)
{
int t_index = 0;
int t_Line_no = 0, t_Col_no = 0;
string tstr_Symbol_Code = "";
double t_Value_01 = 0, t_Value_02 = 0, t_Value_03 = 0;
Colors t_Clr_01 = Clr_Value_01, t_Clr_02 = Clr_Value_02;
// COPY ROW COL POSITION
t_Line_no = t_Row;
t_Col_no = t_Col;
//t_Offset = 2;
string str_TF01 = TimeFrameToShortName(p_Volitality_TF_01);
string str_TF02 = TimeFrameToShortName(p_ATR_TF_01);
// LOOP FOR 8-MAJOR PAIRS
for (int i = 0; i < 8; i++)
{
//-- 1ST COL HEADING
Draw_OnChart_C1("DH8MP001", t_Line_no - 3, t_Col_no + 0, str_TF01, Clr_Heading_2);
Draw_OnChart_C1("DH8MP001", t_Line_no - 2, t_Col_no + 0, "Hi-Lo", Clr_Heading_2);
Draw_OnChart_C1("DH8MP001", t_Line_no - 1, t_Col_no + 0, "Volit", Clr_Heading_2);
//-- 2ND COL HEADING
Draw_OnChart_C1("DH8MP011", t_Line_no - 3, t_Col_no + 1, "P=" + p_ATR_Period.ToString(), Clr_Heading_2);
Draw_OnChart_C1("DH8MP011", t_Line_no - 2, t_Col_no + 1, str_TF02, Clr_Heading_2);
Draw_OnChart_C1("DH8MP011", t_Line_no - 1, t_Col_no + 1, "ATR", Clr_Heading_2);
//-- 3rd HEADING
Draw_OnChart_C1("DH8MP021", t_Line_no - 2, t_Col_no + 2, str_TF02, Clr_Heading_2);
Draw_OnChart_C1("DH8MP021", t_Line_no - 1, t_Col_no + 2, "TPips", Clr_Heading_2);
// LOOP FOR 7-TIME FRAME
for (int j = 0; j < 7; j++)
{
// GET PAIR SYMBOL CODE
tstr_Symbol_Code = MajorPair_Symbol[i, j];
int t_BsQt = Base_Currency[i, j];
// MEHTOD TO FIND THE SEARCH INDEX
t_index = Return_Pair_Index_Position(tstr_Symbol_Code);
// GET VALUES FROM ARRAY
t_Value_01 = All_28_Pair_Volitality[t_index];
t_Value_02 = All_28P_ATR_Value_15mins[t_index];
// GET THE PIPS +/- VALUE AND MULTIPLY BY BaseQuote
t_Value_03 = All_28_Pair_15min_Pips[t_index] * t_BsQt;
//Print("i= " + i.ToString() + ", j= " + j.ToString() + ", t_index= " + t_index.ToString() + ", " + tstr_Symbol_Code);
// DISPLAY
string str_1 = t_Value_01.ToString("0.0");
string str_2 = t_Value_02.ToString("0.0");
string str_3 = t_Value_03.ToString("0");
// SET DISPLAY COLOR
// since Tick Vol has been normalized by subtracting by the lowest;
// therefore, a value greater then 500 is enough to point out the outstanding pair.
if (Math.Abs(t_Value_01) >= t_Value_02 || Math.Abs(t_Value_03) > t_Value_02)
{
if (t_Value_03 > 0)
{
t_Clr_01 = Clr_Positive;
t_Clr_02 = Clr_Positive;
}
if (t_Value_03 < 0)
{
t_Clr_01 = Clr_Negative;
t_Clr_02 = Clr_Negative;
}
// ALERT/PLAY SOUND
Play_Sound_on_Signal();
}
else
{
t_Clr_01 = Clr_Value_01;
/// SHOW PIPS COLOR in +ve or -ve color always
if (t_Value_03 > 0)
t_Clr_02 = Clr_Positive;
else
t_Clr_02 = Clr_Negative;
}
Draw_OnChart_C1("DH8MP01", t_Line_no, t_Col_no + 0, str_1, t_Clr_01);
Draw_OnChart_C1("DH8MP02", t_Line_no, t_Col_no + 1, str_2, t_Clr_01);
Draw_OnChart_C1("DH8MP03", t_Line_no, t_Col_no + 2, str_3, t_Clr_02);
///INC ROW
t_Line_no += 1;
}
//END FOR
///INC ROW
t_Line_no += Line_Offset;
// SHIFT COL AND RESET ROW
if (i == 3)
{
t_Col_no += Col_Offset;
t_Line_no = t_Row;
}
//END IF
}
//END FOR
}
////---- END METHOD Display_Volitatlity_and_ATR()
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
////---- Display_Volitatlity_and_ATR_with_TICK_Volume ----//////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
private void Display_Volitatlity_and_ATR_with_TICK_Volume(int t_Row, int t_Col)
{
int t_index = 0;
int t_Line_no = 0, t_Col_no = 0;
string tstr_Symbol_Code = "";
double t_Value_01 = 0, t_Value_02 = 0, t_Value_03 = 0, t_Value_04 = 0;
Colors t_Clr_01 = Clr_Value_01, t_Clr_02 = Clr_Value_02;
// COPY ROW COL POSITION
t_Line_no = t_Row;
t_Col_no = t_Col;
//t_Offset = 2;
// LOOP FOR 8-MAJOR PAIRS
for (int i = 0; i < 8; i++)
{
//-- 1ST COL HEADING
Draw_OnChart_C1("DH8MP001", t_Line_no - 3, t_Col_no + 0, p_Volitality_TF_01.ToString(), Clr_Heading_2);
Draw_OnChart_C1("DH8MP001", t_Line_no - 2, t_Col_no + 0, "Hi-Lo", Clr_Heading_2);
Draw_OnChart_C1("DH8MP001", t_Line_no - 1, t_Col_no + 0, "Volit", Clr_Heading_2);
//-- 2ND COL HEADING
Draw_OnChart_C1("DH8MP011", t_Line_no - 3, t_Col_no + 1, "P=" + p_ATR_Period.ToString(), Clr_Heading_2);
Draw_OnChart_C1("DH8MP011", t_Line_no - 2, t_Col_no + 1, p_ATR_TF_01.ToString(), Clr_Heading_2);
Draw_OnChart_C1("DH8MP011", t_Line_no - 1, t_Col_no + 1, "ATR", Clr_Heading_2);
//-- 3rd HEADING
Draw_OnChart_C1("DH8MP021", t_Line_no - 2, t_Col_no + 2, p_ATR_TF_01.ToString(), Clr_Heading_2);
Draw_OnChart_C1("DH8MP021", t_Line_no - 1, t_Col_no + 2, "TPips", Clr_Heading_2);
//-- 4TH HEADING
Draw_OnChart_C1("DH8MP031", t_Line_no - 2, t_Col_no + 3, p_ATR_TF_01.ToString(), Clr_Heading_2);
Draw_OnChart_C1("DH8MP031", t_Line_no - 1, t_Col_no + 3, "TK.Vol", Clr_Heading_2);
// LOOP FOR 7-TIME FRAME
for (int j = 0; j < 7; j++)
{
// GET PAIR SYMBOL CODE
tstr_Symbol_Code = MajorPair_Symbol[i, j];
int t_BsQt = Base_Currency[i, j];
// MEHTOD TO FIND THE SEARCH INDEX
t_index = Return_Pair_Index_Position(tstr_Symbol_Code);
// GET VALUES FROM ARRAY
t_Value_01 = All_28_Pair_Volitality[t_index];
t_Value_02 = All_28P_ATR_Value_15mins[t_index];
// GET THE PIPS +/- VALUE AND MULTIPLY BY BaseQuote
t_Value_03 = All_28_Pair_15min_Pips[t_index] * t_BsQt;
// TICK VOL COUNT
t_Value_04 = All_28_Pair_Tick_Volume[t_index];
//Print("i= " + i.ToString() + ", j= " + j.ToString() + ", t_index= " + t_index.ToString() + ", " + tstr_Symbol_Code);
// DISPLAY
string str_1 = t_Value_01.ToString("0.0");
string str_2 = t_Value_02.ToString("0.0");
string str_3 = t_Value_03.ToString("0");
string str_4 = t_Value_04.ToString("0");
// SET DISPLAY COLOR
// since Tick Vol has been normalized by subtracting by the lowest;
// therefore, a value greater then 500 is enough to point out the outstanding pair.
if (t_Value_01 >= t_Value_02 || t_Value_03 > t_Value_02)
{
if (t_Value_03 > 0)
{
t_Clr_01 = Clr_Positive;
t_Clr_02 = Clr_Positive;
}
if (t_Value_03 < 0)
{
t_Clr_01 = Clr_Negative;
t_Clr_02 = Clr_Negative;
}
// ALERT/PLAY SOUND
Play_Sound_on_Signal();
}
else
{
t_Clr_01 = Clr_Value_01;
/// SHOW PIPS COLOR in +ve or -ve color always
if (t_Value_03 > 0)
t_Clr_02 = Clr_Positive;
else
t_Clr_02 = Clr_Negative;
}
Draw_OnChart_C1("DH8MP01", t_Line_no, t_Col_no + 0, str_1, t_Clr_01);
Draw_OnChart_C1("DH8MP02", t_Line_no, t_Col_no + 1, str_2, t_Clr_01);
Draw_OnChart_C1("DH8MP03", t_Line_no, t_Col_no + 2, str_3, t_Clr_02);
Draw_OnChart_C1("DH8MP04", t_Line_no, t_Col_no + 3, str_4, t_Clr_01);
///INC ROW
t_Line_no += 1;
}
//END FOR
///INC ROW
t_Line_no += Line_Offset;
// SHIFT COL AND RESET ROW
if (i == 3)
{
t_Col_no += Col_Offset;
t_Line_no = t_Row;
}
//END IF
}
//END FOR
}
////---- END METHOD Display_Volitatlity_and_ATR_with_TICK_Volume()
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
////---- Display_Total_Pips_ATR_Values_Hourly ----//////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
private void Display_Total_Pips_ATR_Values_Hourly(int t_Row, int t_Col)
{
int t_index = 0;
int t_Line_no = 0, t_Col_no = 0;
string tstr_Symbol_Code = "";
double t_Value_05 = 0;
Colors t_Clr_01 = Clr_Value_01, t_Clr_02 = Clr_Value_02;
// COPY ROW COL POSITION
t_Line_no = t_Row;
t_Col_no = t_Col;
//t_Offset = 2;
string str_TF01 = TimeFrameToShortName(TimeFrame.Hour);
// LOOP FOR 8-MAJOR PAIRS
for (int i = 0; i < 8; i++)
{
//-- 1st HEADING
Draw_OnChart_C1("DH8MP031", t_Line_no - 3, t_Col_no + 0, "T.Pips", Clr_Heading_2);
Draw_OnChart_C1("DH8MP031", t_Line_no - 2, t_Col_no + 0, "/ ATR", Clr_Heading_2);
Draw_OnChart_C1("DH8MP031", t_Line_no - 1, t_Col_no + 0, str_TF01, Clr_Heading_2);
// LOOP FOR 7-TIME FRAME
for (int j = 0; j < 7; j++)
{
// GET PAIR SYMBOL CODE
tstr_Symbol_Code = MajorPair_Symbol[i, j];
int t_BsQt = Base_Currency[i, j];
// MEHTOD TO FIND THE SEARCH INDEX
t_index = Return_Pair_Index_Position(tstr_Symbol_Code);
// T.PIPS / ATR VALUES
t_Value_05 = All_28P_TPIPS_ATR_Val_Hour[t_index];
//Print("i= " + i.ToString() + ", j= " + j.ToString() + ", t_index= " + t_index.ToString() + ", " + tstr_Symbol_Code);
// DISPLAY
string str_5 = t_Value_05.ToString("0.0");
// SET DISPLAY COLOR
if (Math.Abs(t_Value_05) >= 4)
{
t_Clr_01 = Clr_True;
// ALERT/PLAY SOUND
Play_Sound_on_Signal();
}
else
{
t_Clr_01 = Clr_Value_01;
}
Draw_OnChart_C1("DH8MP05", t_Line_no, t_Col_no + 0, str_5, t_Clr_01);
///INC ROW
t_Line_no += 1;
}
//END FOR
///INC ROW
t_Line_no += Line_Offset;
// SHIFT COL AND RESET ROW
if (i == 3)
{
t_Col_no += Col_Offset;
t_Line_no = t_Row;
}
//END IF
}
//END FOR
}
////---- END METHOD Display_Total_Pips_ATR_Values_Hourly()
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
////---- Display_Total_Pips_ATR_Values_4_Huorly ----//////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
private void Display_Total_Pips_ATR_Values_4_Huorly(int t_Row, int t_Col)
{
int t_index = 0;
int t_Line_no = 0, t_Col_no = 0;
string tstr_Symbol_Code = "";
double t_Value_06 = 0;
Colors t_Clr_01 = Clr_Value_01, t_Clr_02 = Clr_Value_02;
// COPY ROW COL POSITION
t_Line_no = t_Row;
t_Col_no = t_Col;
//t_Offset = 2;
string str_TF01 = TimeFrameToShortName(TimeFrame.Hour4);
// LOOP FOR 8-MAJOR PAIRS
for (int i = 0; i < 8; i++)
{
//-- 1st HEADING
Draw_OnChart_C1("DH8MP031", t_Line_no - 3, t_Col_no + 0, "T.Pips", Clr_Heading_2);
Draw_OnChart_C1("DH8MP031", t_Line_no - 2, t_Col_no + 0, "/ATR", Clr_Heading_2);
Draw_OnChart_C1("DH8MP031", t_Line_no - 1, t_Col_no + 0, str_TF01, Clr_Heading_2);
// LOOP FOR 7-TIME FRAME
for (int j = 0; j < 7; j++)
{
// GET PAIR SYMBOL CODE
tstr_Symbol_Code = MajorPair_Symbol[i, j];
int t_BsQt = Base_Currency[i, j];
// MEHTOD TO FIND THE SEARCH INDEX
t_index = Return_Pair_Index_Position(tstr_Symbol_Code);
// T.PIPS / ATR VALUES
t_Value_06 = All_28P_TPIPS_ATR_Val_4Hour[t_index];
//Print("i= " + i.ToString() + ", j= " + j.ToString() + ", t_index= " + t_index.ToString() + ", " + tstr_Symbol_Code);
// DISPLAY
string str_6 = t_Value_06.ToString("0.0");
// SET DISPLAY COLOR
if (Math.Abs(t_Value_06) >= 1.2)
{
t_Clr_01 = Clr_True;
// ALERT/PLAY SOUND
Play_Sound_on_Signal();
}
else
{
t_Clr_01 = Clr_Value_01;
}
Draw_OnChart_C1("DH8MP06", t_Line_no, t_Col_no + 0, str_6, t_Clr_01);
///INC ROW
t_Line_no += 1;
}
//END FOR
///INC ROW
t_Line_no += Line_Offset;
// SHIFT COL AND RESET ROW
if (i == 3)
{
t_Col_no += Col_Offset;
t_Line_no = t_Row;
}
//END IF
}
//END FOR
}
////---- END METHOD Display_Total_Pips_ATR_Values_4_Huorly()
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
////---- Main_cBOT_Logic ----//////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
private void Main_cBOT_Logic()
{
////---------------------------------------
////--- AUTO OR MANUAL TRADE --------
bool t_Condition_01 = false;
/// MANUAL OR AUTO TRADING
if (p_Manually_Start == 1)
{
/// USER TO MAKE FIRST TRADE
if (Positions.Count >= 1)
t_Condition_01 = true;
}
///---- IF AUTO TRADE
if (p_Manually_Start == 0)
{
t_Condition_01 = true;
}
///END IF
///-----------------------------------------------------------------
///--- TRADING TIME RANGE DURING THE DAY IS TRUE --------------
if (Trading_Time == true && t_Condition_01 == true)
{
///- CHECK MAX NO OF OPEN POSITIONS
if (Total_Account_Pos_Count <= p_Max_No_of_Positions_to_Open)
{
///- HOUR -DAY -WEEK TRADING IS TRUE
if (Flag_Trading_Till_Next_Hr == true && Flag_Trading_Till_Next_Dy == true && Flag_Trading_Till_Next_Wk == true)
{
Entry_Trades_Orignal_Logic_01();
}
// END IF
}
// END IF
}
// END IF
}
////---- END METHOD Main_cBOT_Logic()
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//// Manage_Open_Trades //////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
private void Manage_Open_Trades()
{
// METHOD EXCLUSIVE CONTROL FLAG
if (Flag_isExecuting_10 == false)
{
// SET THE FLAG
Flag_isExecuting_10 = true;
// SCALING ON OFF - ADD TO WINNERS ONLY
// CHECK FOR MARGIN LEVEL
if (p_SCALE_IN_ON_OFF == 1 && Total_Account_Pos_Count <= p_Max_No_of_Positions_to_Open)
{
Manage_Trades_By_Scale_IN();
}
// BREAK EVEN
if (p_Break_Even_SL_ON_OFF == 1)
{
Adjust_Stop_Loss_To_Break_Even();
}
// TRAILING STOP LOSS
if (p_Trailing_SL_ON_OFF == 1)
{
Adjust_Trailing_Stop_Loss();
}
// RESET THE FLAG
Flag_isExecuting_10 = false;
}
//END IF (Flag_isExecuting_10 = false)
}
// END METHOD Manage_Open_Trades
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//// Control_Strategies //////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
private void Control_Strategies()
{
}
// END METHOD Control_Strategies
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//// Exit_Strategies //////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
private void Exit_Strategies()
{
// EQ MANAGER
if (p_Equity_Manager == 1)
{
//Get_Equity_Manager();
}
// IF CONDITION IS SET TO TRUE
if (p_Target_NETPL_ON_OFF == 1)
{
//Check_NetPL_Single_Pair();
}
// IF CONDITION IS SET TO TRUE
if (p_LOCK_IN_PORIFT_ON_OFF == 1)
{
//Adjust_28Pair_Profit_Lock_IN();
}
}
// END METHOD Exit_Strategies
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//// Entry_Trades_Orignal_Logic_01 //////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
private void Entry_Trades_Orignal_Logic_01()
{
///-- EXCLUSIVE METHOD CONTROL
if (Flag_isExecuting_11 == false)
{
// SET THE FLAG
Flag_isExecuting_11 = true;
Symbol t_Symbol;
string tstr_Symbol_Code;
//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 UPDATED MARGIN LEVEL
Get_Account_Margin_Level();
///-- ONLY IF ENOUGH MARGIN LEVEL
if (Flag_Acc_Margin_Level_01 == true)
{
}
//END IF (Flag_Acc_Margin_Level_01 == true)
}
///-- END FOR
// RESET THE FLAG
Flag_isExecuting_11 = false;
}
//END IF (Flag_isExecuting_11 = false)
}
//END METHOD Entry_Trades_Orignal_Logic_01
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//// Manage_Trades_By_Scale_IN //////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
private void Manage_Trades_By_Scale_IN()
{
///-- EXCLUSIVE METHOD CONTROL
///-- Flag_isExecuting_20 IS CONTROL FLAG USED IN
///-- METHOD ON_POSITIONS_CLOSED. SO IF TRUE THEN HOLD ON TO SCALE IN
if (Flag_isExecuting_12 == false && Flag_isExecuting_20 == false)
{
// SET THE FLAG
Flag_isExecuting_12 = true;
///-- GET UPDATED MARGIN LEVEL
Get_Account_Margin_Level();
///-- ONLY IF ENOUGH MARGIN LEVEL >= 300
if (Flag_Acc_Margin_Level_02 == true)
{
}
//END IF (Flag_Acc_Margin_Level_02 == true)
// RESET THE FLAG
Flag_isExecuting_12 = false;
}
//END IF (Flag_isExecuting_12 = false)
}
//END METHOD Manage_Trades_By_Scale_IN
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//// Adjust_Stop_Loss_To_Break_Even //////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
private void Adjust_Stop_Loss_To_Break_Even()
{
///-- EXCLUSIVE METHOD CONTROL
if (Flag_isExecuting_21 == false)
{
// SET THE FLAG
Flag_isExecuting_21 = true;
// RESET THE FLAG
Flag_isExecuting_21 = false;
}
//END IF (Flag_isExecuting_21 = false)
}
//END METHOD Adjust_Stop_Loss_To_Break_Even
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//// Adjust_Trailing_Stop_Loss //////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
private void Adjust_Trailing_Stop_Loss()
{
///-- EXCLUSIVE METHOD CONTROL
if (Flag_isExecuting_22 == false)
{
// SET THE FLAG
Flag_isExecuting_22 = true;
// RESET THE FLAG
Flag_isExecuting_22 = false;
}
//END IF (Flag_isExecuting_22 = false)
}
//END METHOD Adjust_Trailing_Stop_Loss
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
////---- On_Change_of_Time ----//////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
protected void On_Change_of_Time()
{
// ADD ANY LOGIC TO BELOW IF CLAUSE
///------------------------------------------------
///--- GET CURRENT DIFFERENT TIME -----------
Hour_01 = (int)Server.Time.Hour;
Day_01 = (int)Server.Time.Day;
Week_01 = (int)Server.Time.DayOfWeek;
Month_01 = (int)Server.Time.Month;
///-----------------------------------------------
// CHECK CHANGE OF HOUR --------------------------
if (Hour_01 != Hour_02)
{
///--- RESET
Flag_Trading_Till_Next_Hr = true;
}
//END IF
// CHECK CHANGE OF DAY --------------------------
if (Day_01 != Day_02)
{
/// -INITIALIZE INDICATOR ON DAY CHANGE
Initialize_Indicators();
//RESET ARRAYS ON DAY CHANGE OR WHEN cBOT STARTS
Reset_Arrays_on_Day_Change();
//RESET DATA ON DAY CHANGE
Reset_Data_on_Day_Change();
///--- RESET
Flag_Trading_Till_Next_Dy = true;
}
//END IF
// CHECK CHANGE OF WEEK ------------------------
if (Week_01 != Week_02)
{
///--- RESET
Flag_Trading_Till_Next_Wk = true;
}
//END IF
// CHECK CHANGE OF MONTH ------------------------
if (Month_01 != Month_02)
{
}
//END IF
///--------------------------
///--- MAKE COPY ------------
Hour_02 = Hour_01;
Day_02 = Day_01;
Week_02 = Week_01;
Month_02 = Month_01;
}
////---- END METHOD On_Change_of_Time()
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//// Reset_Arrays_on_Day_Change //////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
private void Reset_Arrays_on_Day_Change()
{
}
////---- END METHOD Reset_Arrays_on_Day_Change()
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//// Reset_Data_on_Day_Change //////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
private void Reset_Data_on_Day_Change()
{
}
////---- END METHOD Reset_Data_on_Day_Change()
//////////////////////////////////////////////////////////////////////////////
////---- Update_Methods_Data_OnBAR ----/////////////////
//////////////////////////////////////////////////////////////////////////////
private void Update_Methods_Data_OnBAR()
{
// METHOD EXCLUSIVE CONTROL FLAG
if (Flag_isExecuting_04 == false)
{
// SET THE FLAG
Flag_isExecuting_04 = true;
///--- ATR VALUES
Print("5A. : Get 28P & 8MPairs ATR Values");
Get_ATR_Values();
// RESET THE FLAG
Flag_isExecuting_04 = false;
}
//END if (Flag_isExecuting_04 == false)
}
////---- END METHOD Update_Methods_Data_OnBAR()
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
////---- Upate_Dynamic_Values_On_Tick ----//////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
private void Upate_Dynamic_Values_On_Tick()
{
///-- EXCLUSIVE METHOD CONTROL
if (Flag_isExecuting_05 == false)
{
// SET THE FLAG
Flag_isExecuting_05 = true;
// RESET THE FLAG
Flag_isExecuting_05 = false;
}
//END if (Flag_isExecuting_05 == false)
}
////---- END METHOD Upate_Dynamic_Values_On_Tick()
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
////---- Upate_Dynamic_Values_On_Timer ----//////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
private void Upate_Dynamic_Values_On_Timer()
{
if (Flag_isExecuting_06 == false)
{
// SET THE FLAG
Flag_isExecuting_06 = true;
///----------------------------------------
///--- GET CANDLES VOLITALITY -------
Get_28Pair_Candle_Volitatlity();
////////////////////////////////////
///----- GROUP # 02 --------------
int c2_Col = 1;
int r2_Row = 7;
///--- MAJOR PAIR WITH SUB PAIR
Display_Heading_All_MajorPair_AND_Sub_Pair((St_Line_No + r2_Row), (St_Col_No + c2_Col));
Print("Check Level 02");
///--- VOLITALITY 1 MIN CANDLE ++ ATR OF 15MIN TIME FRAME
Display_Volitatlity_and_ATR((St_Line_No + r2_Row), (St_Col_No + c2_Col + 2));
///--- 1-Hour - T.PIPS / ATR INDICATOR VALUES
Display_Total_Pips_ATR_Values_Hourly((St_Line_No + r2_Row), (St_Col_No + c2_Col + 5));
///--- 4-Hour - T.PIPS / ATR INDICATOR VALUES
Display_Total_Pips_ATR_Values_4_Huorly((St_Line_No + r2_Row), (St_Col_No + c2_Col + 6));
////////////////////////////////////
///----- GROUP # 03 --------------
int c3_Col = 23;
int r3_Row = 9;
Print("Check Level 03");
///-- PAIR NAME
Display_28_Pair_Pairs_Name_01((St_Line_No + r3_Row), (St_Col_No + c3_Col));
// RESET THE FLAG
Flag_isExecuting_06 = false;
}
//END if (Flag_isExecuting_06 == false)
}
////---- END METHOD Upate_Dynamic_Values_On_Timer()
////////////////////////////////////////////////////////////////////////////////////////////
////--- Close_Positions_with_Trade_Type ///////////
////////////////////////////////////////////////////////////////////////////////////////////
private void Close_Positions_with_Trade_Type(TradeType tradeType)
{
foreach (var pos in Positions)
{
if (pos.TradeType == tradeType)
{
ClosePosition(pos);
}
//END IF
}
//END FOR-EACH
}
//END METHOD Close_Positions_with_Trade_Type
////////////////////////////////////////////////////////////////////////////////////////////
////--- Close_Positions_with_Label //////////
////////////////////////////////////////////////////////////////////////////////////////////
private void Close_Positions_with_Label(string label)
{
foreach (var pos in Positions)
{
if (pos.Label == label)
{
ClosePosition(pos);
}
//END IF
}
//END FOR-EACH
}
//END METHOD CloseAll_Positions_with_Label
////////////////////////////////////////////////////////////////////////////////////////////
////--- Close_Positions_with_Symbol_Trade_Type ////////////////
////////////////////////////////////////////////////////////////////////////////////////////
private void Close_Positions_with_Symbol_Trade_Type(string t_Symbol_Code, TradeType t_TradeType)
{
foreach (var pos in Positions)
{
if (pos.SymbolCode == t_Symbol_Code && pos.TradeType == t_TradeType)
{
ClosePosition(pos);
}
//END IF
}
//END FOR-EACH
}
//END METHOD Close_Positions_with_Symbol_Trade_Type
////////////////////////////////////////////////////////////////////////////////////////////
////--- Close_Positions_with_Symbol_Trade_Type ////////////////
////////////////////////////////////////////////////////////////////////////////////////////
private void Close_Positions_with_Symbol_Trade_Type_and_Pips(string t_Symbol_Code, TradeType t_TradeType, int t_Pips)
{
foreach (var pos in Positions)
{
if (pos.SymbolCode == t_Symbol_Code && pos.TradeType == t_TradeType && pos.Pips < t_Pips)
{
ClosePosition(pos);
}
//END IF
}
//END FOR-EACH
}
//END METHOD Close_Positions_with_Symbol_Trade_Type
////////////////////////////////////////////////////////////////////////////////////////////
////--- Close_Positions_with_Symbol /////////////
////////////////////////////////////////////////////////////////////////////////////////////
private void Close_Positions_with_Symbol(Symbol t_Symbol)
{
foreach (var pos in Positions)
{
if (pos.SymbolCode == t_Symbol.Code)
{
ClosePosition(pos);
}
//END IF
}
//END FOR-EACH
}
//END METHOD Close_Positions_with_Symbol
////////////////////////////////////////////////////////////////////////////////////////////
////--- Close_Positions_Amount //////////////
////////////////////////////////////////////////////////////////////////////////////////////
private void Close_Positions_Amount(int t_Amount)
{
///-----
// CLOSE THAT ARE ABOVE/BELOW THE AMOUNT VALUE (t_Amount )
///-----
foreach (var pos in Positions)
{
//IF POSITIVE VALUE
if (t_Amount >= 0)
if (pos.NetProfit >= t_Amount)
ClosePositionAsync(pos);
//IF NEGATIVE VALUE
if (t_Amount < 0)
if (pos.NetProfit <= t_Amount)
ClosePositionAsync(pos);
}
//END FOR-EACH
}
//END FUNCTION Close_Positions_Amount
////////////////////////////////////////////////////////////////////////////////////////////
////----- CloseAll_Every_Position ////////////////
////////////////////////////////////////////////////////////////////////////////////////////
private void CloseAll_Every_Position()
{
// LOOP TO GET ALL POSITIONS
foreach (var pos in Positions)
{
ClosePosition(pos);
}
//END FOR-EACH
}
//END METHOD CloseAll_Every_Position
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////--- OnPositionsOpened //////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
private void OnPositionsOpened(PositionOpenedEventArgs args)
{
Print("\n---------##### ON_POSITION___OPENED #####---------");
var pos = args.Position;
///--- UPDATE POSITIONS COUNTS
Get_Positions_Count_Volume_PipCost();
}
//END METHOD OnPositionsOpened
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////--- OnPositionsClosed //////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
private void OnPositionsClosed(PositionClosedEventArgs args)
{
Print("\n---------##### ON_POSITION_CLOSED #####---------");
var pos = args.Position;
////--------------------------------------------------------
////--- CLOSE IF FIRST POSITION IS CLOSED
// CLOSE IF BUY ORDER AND THAT ALSO FIRST BUY ORDER
if (pos.TradeType == TradeType.Buy)
{
if (pos.Label == Label_1st_Buy)
{
// CONTROL FLAG FOR SCALE-IN METHOD SO IT DOES NOT
// OPEN NEW ORDERS -----------------------------------
Flag_isExecuting_20 = true;
//Close_Positions_with_Symbol_Trade_Type(pos.SymbolCode, TradeType.Buy);
Flag_isExecuting_20 = false;
}
}
//END IF
// CIF SELL ORDER AND THAT ALSO FIRST SELL ORDER
if (pos.TradeType == TradeType.Sell)
{
if (pos.Label == Label_1st_Sell)
{
// CONTROL FLAG FOR SCALE-IN METHOD SO IT DOES NOT
// OPEN NEW ORDERS -----------------------------------
Flag_isExecuting_20 = true;
//Close_Positions_with_Symbol_Trade_Type(pos.SymbolCode, TradeType.Sell);
Flag_isExecuting_20 = false;
}
}
//END IF
///--- UPDATE POSITIONS COUNTS
Get_Positions_Count_Volume_PipCost();
}
//END METHOD PositionsOnClosed
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
////---- Get_Account_Margin_Level ----//////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
private void Get_Account_Margin_Level()
{
///-------------------------------------------------------
// CHECK FOR MARGIN LEVEL CONDITION
// CHECK IF THERE IS ATLEAST 1 POSITION OPENED OR NOT.
if (Positions.Count > 0)
{
// IF 1 OR MORE POSITION OPENED THEN CHECK FOR MARGIN LEVEL
if (Account.MarginLevel > p_Min_Margin_Level_01)
Flag_Acc_Margin_Level_01 = true;
else
Flag_Acc_Margin_Level_01 = false;
// IF 1 OR MORE POSITION OPENED THEN CHECK FOR MARGIN LEVEL
if (Account.MarginLevel > p_Min_Margin_Level_02)
Flag_Acc_Margin_Level_02 = true;
else
Flag_Acc_Margin_Level_02 = false;
}
else
{
Flag_Acc_Margin_Level_01 = true;
Flag_Acc_Margin_Level_02 = true;
}
// END IF ELSE
}
////---- END METHOD Get_Account_Margin_Level()
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//// Get_Positions_Count_Volume_PipCost //////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
private void Get_Positions_Count_Volume_PipCost()
{
// METHOD EXCLUSIVE CONTROL FLAG
if (Flag_isExecuting_23 == false)
{
// SET THE FLAG
Flag_isExecuting_23 = true;
// RESET THE FLAG
Flag_isExecuting_23 = false;
}
//END IF (Flag_isExecuting_23 == false)
}
////---- END METHOD Get_Positions_Count_Volume_PipCost()
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
////---- Set_Few_Default_Value_On_Start ----/////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
private void Set_Few_Default_Value_On_Start()
{
///-------------------------------------------------------
///--- INITIALIZE "onPositionClosed/Opened" --------------
Positions.Closed += OnPositionsClosed;
Positions.Opened += OnPositionsOpened;
///--------------------------------------------------------
///--- TODAY's DATE ---------------------------------------
Todays_Date = string.Format("{0:d}", Server.Time);
///--------------------------------------------------------
// EQUITY REFERENCE VALUE -----------------------
Start_Equity = (int)Account.Equity;
///---------------------------------------------
///--- GET DAY OF THE WEEK ------------------
Hour_01 = (int)Server.Time.Hour;
Day_01 = (int)Server.Time.Day;
Week_01 = (int)Server.Time.DayOfWeek;
Month_01 = (int)Server.Time.Month;
// MAKE COPY
Hour_02 = Hour_01;
Day_02 = Day_01;
Week_02 = Week_01;
Month_02 = Month_01;
}
////---- END METHOD Set_Few_Default_Value_On_Start()
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////--- Get_28Pair_Candle_Volitatlity ///////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
private void Get_28Pair_Candle_Volitatlity()
{
///-- EXCLUSIVE METHOD CONTROL
if (Flag_isExecuting_14 == false)
{
// SET THE FLAG
Flag_isExecuting_14 = true;
Symbol t_Symbol;
string tstr_Symbol_Code;
double t_PipSize = 0;
//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;
All_28_Pair_Ask_Price[i] = t_Symbol.Ask;
All_28_Pair_Bid_Price[i] = t_Symbol.Bid;
double t_High_Price = MrktSries_Price_01_min[i].High.LastValue;
double t_Low_Price = MrktSries_Price_01_min[i].Low.LastValue;
double t_Volitality = (t_High_Price - t_Low_Price) / t_PipSize;
double t_Close = MrktSries_Price_15min[i].Close.LastValue;
double t_Open = MrktSries_Price_15min[i].Open.LastValue;
double t_Pips = (t_Close - t_Open) / t_PipSize;
///--- STORE VALUE IN ARRAY
All_28_Pair_Volitality[i] = t_Volitality;
All_28_Pair_15min_Pips[i] = t_Pips;
All_28_Pair_Tick_Volume[i] = MrktSries_Price_15min[i].TickVolume.Count;
Normalize_Tick_Volume();
/// GET T.PIPS / ATR VALUES
Print("Check Level 03");
All_28P_TPIPS_ATR_Val_Hour[i] = Indi_MP_ATR_1Hour[i].Close_Value(0);
All_28P_TPIPS_ATR_Val_4Hour[i] = Indi_MP_ATR_4Hour[i].Close_Value(0);
}
///-- END FOR
// RESET THE FLAG
Flag_isExecuting_14 = false;
}
//END IF (Flag_isExecuting_14 = false)
}
//END MEHTOD Get_28Pair_Candle_Volitatlity
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
////---- TEST_FUNCTION ----//////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
private void Normalize_Tick_Volume()
{
double t_Lowest = 0;
// FIND THE HIGHEST VALUE
t_Lowest = All_28_Pair_Tick_Volume[0];
//LOOP FOR 28 PAIRS
for (int i = 0; i < 28; i++)
{
if (All_28_Pair_Tick_Volume[i] <= t_Lowest)
t_Lowest = All_28_Pair_Tick_Volume[i];
}
// NORMALIZE THE OTHER PAIR TICK VOLUME COUNT
// BY SUBTRACTING THE LOWEST VALUE FROM EACH
//LOOP FOR 28 PAIRS
for (int i = 0; i < 28; i++)
{
All_28_Pair_Tick_Volume[i] = All_28_Pair_Tick_Volume[i] - t_Lowest;
}
}
////---- END METHOD Test_Function()
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////--- Get_ATR_Values ///////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
private void Get_ATR_Values()
{
///-- EXCLUSIVE METHOD CONTROL
if (Flag_isExecuting_13 == false)
{
// SET THE FLAG
Flag_isExecuting_13 = true;
Symbol t_Symbol;
string tstr_Symbol_Code;
double t_PipSize = 0;
//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 ATR VALUE ----------------------
///--- 15-MIN ATR
int t_G1 = (int)(Indi_ATR_28P_15mins[i].Result.Last(1) / t_PipSize);
///---------------------------------------------------
///--- STORE IN ARRAY ----------------------
///--- 15-MIN ATR
All_28P_ATR_Value_15mins[i] = t_G1;
}
///-- END FOR
// RESET THE FLAG
Flag_isExecuting_13 = false;
}
//END IF (Flag_isExecuting_13 = false)
}
//END MEHTOD Get_ATR_Values
///////////////////////////////////////////////////////////////////////////////////////////
////--- Initialize_Indicators /////////////////////
///////////////////////////////////////////////////////////////////////////////////////////
private void Initialize_Indicators()
{
double t_PipSize = 0;
Symbol t_Symbol;
string tstr_Symbol_Code;
// ---------------------------------------------
//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;
///-------------------------------------------------------
///--- CANDLE PRICES --------------------------
///--- 15MIN CANDLE - HIGH LOW PRICE
MrktSries_Price_15min[i] = MarketData.GetSeries(tstr_Symbol_Code, p_ATR_TF_01);
///--- 01-MIN CANDLE - HIGH LOW PRICE
MrktSries_Price_01_min[i] = MarketData.GetSeries(tstr_Symbol_Code, p_Volitality_TF_01);
///--------------------------------------------------
///---- ATR 28 PAIRS --------------------------
///--- 15min ATR, P = 10
MrktSeries_ATR_15mins[i] = MarketData.GetSeries(tstr_Symbol_Code, p_ATR_TF_01);
Indi_ATR_28P_15mins[i] = Indicators.AverageTrueRange(MrktSeries_ATR_15mins[i], p_ATR_Period, MovingAverageType.Exponential);
MrktSries_Price_01_Hour[i] = MarketData.GetSeries(tstr_Symbol_Code, TimeFrame.Hour);
MrktSries_Price_04_Hour[i] = MarketData.GetSeries(tstr_Symbol_Code, TimeFrame.Hour4);
Indi_MP_ATR_1Hour[i] = Indicators.GetIndicator<MajorPair_Total_Pips_Single_Pair_ATR>(MrktSries_Price_01_Hour[i], tstr_Symbol_Code, TimeFrame.Weekly, 0, 3, false, 50, 1.6);
Indi_MP_ATR_4Hour[i] = Indicators.GetIndicator<MajorPair_Total_Pips_Single_Pair_ATR>(MrktSries_Price_04_Hour[i], tstr_Symbol_Code, TimeFrame.Weekly, 0, 3, false, 50, 1.6);
Print((i + 1).ToString() + ". " + tstr_Symbol_Code);
}
//END FOR LOOP
string tstr_MP = "";
//LOOP FOR 8 MAJOR PAIRS
for (int i = 0; i < 8; i++)
{
// MAJOR PAIR NAME ABOVE 7-SUB PAIR NAMES -------------------
tstr_MP = MP_Main_Heading[i];
}
//END FOR 8 MP LOOP
}
//END MEHTOD Initialize_Indicators
///////////////////////////////////////////////////////////////////////////////////////////////////////
////--- Declare_All_Arrays ////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////
private void Declare_All_Arrays()
{
///-------------------------------------------------------
///--- 8-MAJOR & 7-Sub PAIRS Headings -----------
MP_Main_Heading = new string[8];
MP_Sub_Heading = new string[8, 7];
///--- MAJOR PAIR OF THE 28 PAIR
MajorP_of_28Pair = new string[28, 3];
///---------------------------------------------------
///--- FULL MAJOR SYMBOL NAME -------------
MajorPair_Symbol = new string[8, 7];
Base_Currency = new int[8, 7];
///------------------------------------------------------
///--- 28-PAIR CODE PIP SIZE VALUE MARGIN ----------
All_28_Pair_Symbol_Code = new string[28];
All_28_Pair_Pip_Size = new double[28];
All_28_Pair_Pip_Value = new double[28];
All_28_Pair_Margin = new double[28];
All_28_Pair_Ask_Price = new double[28];
All_28_Pair_Bid_Price = new double[28];
///--------------------------------------------------
///--- MARKET PRICES -------------------
MrktSries_Price_01_min = new MarketSeries[28];
MrktSries_Price_15min = new MarketSeries[28];
All_28_Pair_Daily_Candle_High_Price = new double[28];
All_28_Pair_Daily_Candle_Low_Price = new double[28];
All_28_Pair_Volitality = new double[28];
All_28_Pair_15min_Pips = new double[28];
All_28_Pair_Tick_Volume = new double[28];
///--------------------------------------------------
///--- INDICATORS -------------------
///--- 28 PAIRS ATR
Indi_ATR_28P_15mins = new AverageTrueRange[28];
MrktSeries_ATR_15mins = new MarketSeries[28];
All_28P_ATR_Value_15mins = new double[28];
///- 8 MAJOR PAIR TOTAL PIPS / ATR INDICATOR
MrktSries_Price_01_Hour = new MarketSeries[28];
MrktSries_Price_04_Hour = new MarketSeries[28];
Indi_MP_ATR_1Hour = new Indicators.MajorPair_Total_Pips_Single_Pair_ATR[28];
Indi_MP_ATR_4Hour = new Indicators.MajorPair_Total_Pips_Single_Pair_ATR[28];
All_28P_TPIPS_ATR_Val_Hour = new double[28];
All_28P_TPIPS_ATR_Val_4Hour = new double[28];
}
////---- END METHOD Declare_All_Arrays()
///////////////////////////////////////////////////////////////////////////////////////////////////////
////--- Initialize_Array_OnStart_Only ///////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////
private void Initialize_Array_OnStart_Only()
{
////-------------------------------------------------
///--- IMPORTANT INPUT SETTINGS ----------------
//INITIALIZATION OF MAJOR PAIR NAMES
MP_Main_Heading[0] = "GBP";
MP_Main_Heading[1] = "EUR";
MP_Main_Heading[2] = "USD";
MP_Main_Heading[3] = "JPY";
MP_Main_Heading[4] = "AUD";
MP_Main_Heading[5] = "NZD";
MP_Main_Heading[6] = "CAD";
MP_Main_Heading[7] = "CHF";
// 1-GBP PAIRS WITH BASE CURRENCY
MP_Sub_Heading[0, 0] = "11. GBP-JPY";
MP_Sub_Heading[0, 1] = "12. GBP-USD";
MP_Sub_Heading[0, 2] = "13. GBP-AUD";
MP_Sub_Heading[0, 3] = "14. GBP-NZD";
MP_Sub_Heading[0, 4] = "15. GBP-CAD";
MP_Sub_Heading[0, 5] = "16. GBP-CHF";
MP_Sub_Heading[0, 6] = "17. EUR-GBP";
// 2-EURO PAIRS WITH BASE CURRENCY
MP_Sub_Heading[1, 0] = "21. EUR-USD";
MP_Sub_Heading[1, 1] = "22. EUR-JPY";
MP_Sub_Heading[1, 2] = "23. EUR-GBP";
MP_Sub_Heading[1, 3] = "24. EUR-AUD";
MP_Sub_Heading[1, 4] = "25. EUR-NZD";
MP_Sub_Heading[1, 5] = "26. EUR-CAD";
MP_Sub_Heading[1, 6] = "27. EUR-CHF";
// 3-USD PAIRS WITH BASE CURRENCY
MP_Sub_Heading[2, 0] = "31. USD-JPY";
MP_Sub_Heading[2, 1] = "32. USD-CAD";
MP_Sub_Heading[2, 2] = "33. USD-CHF";
MP_Sub_Heading[2, 3] = "34. EUR-USD";
MP_Sub_Heading[2, 4] = "35. GBP-USD";
MP_Sub_Heading[2, 5] = "36. AUD-USD";
MP_Sub_Heading[2, 6] = "37. NZD-USD";
// 4-JPY PAIRS WITH BASE CURRENCY
MP_Sub_Heading[3, 0] = "41. USD-JPY";
MP_Sub_Heading[3, 1] = "42. GBP-JPY";
MP_Sub_Heading[3, 2] = "43. EUR-JPY";
MP_Sub_Heading[3, 3] = "44. AUD-JPY";
MP_Sub_Heading[3, 4] = "45. NZD-JPY";
MP_Sub_Heading[3, 5] = "46. CAD-JPY";
MP_Sub_Heading[3, 6] = "47. CHF-JPY";
// 4-AUD PAIRS WITH BASE CURRENCY
MP_Sub_Heading[4, 0] = "51. AUD-JPY";
MP_Sub_Heading[4, 1] = "52. AUD-USD";
MP_Sub_Heading[4, 2] = "53. AUD-NZD";
MP_Sub_Heading[4, 3] = "54. AUD-CAD";
MP_Sub_Heading[4, 4] = "55. AUD-CHF";
MP_Sub_Heading[4, 5] = "56. GBP-AUD";
MP_Sub_Heading[4, 6] = "57. EUR-AUD";
// 5-NZD PAIRS WITH BASE CURRENCY
MP_Sub_Heading[5, 0] = "61. NZD-USD";
MP_Sub_Heading[5, 1] = "62. NZD-JPY";
MP_Sub_Heading[5, 2] = "63. NZD-CAD";
MP_Sub_Heading[5, 3] = "64. NZD-CHF";
MP_Sub_Heading[5, 4] = "65. EUR-NZD";
MP_Sub_Heading[5, 5] = "66. GBP-NZD";
MP_Sub_Heading[5, 6] = "67. AUD-NZD";
// 6-CAD PAIRS WITH BASE CURRENCY
MP_Sub_Heading[6, 0] = "71. CAD-JPY";
MP_Sub_Heading[6, 1] = "72. CAD-CHF";
MP_Sub_Heading[6, 2] = "73. USD-CAD";
MP_Sub_Heading[6, 3] = "74. EUR-CAD";
MP_Sub_Heading[6, 4] = "75. GBP-CAD";
MP_Sub_Heading[6, 5] = "76. AUD-CAD";
MP_Sub_Heading[6, 6] = "77. NZD-CAD";
// 7-CHF PAIRS WITH BASE CURRENCY
MP_Sub_Heading[7, 0] = "81. CHF-JPY";
MP_Sub_Heading[7, 1] = "82. USD-CHF";
MP_Sub_Heading[7, 2] = "83. EUR-CHF";
MP_Sub_Heading[7, 3] = "84. GBP-CHF";
MP_Sub_Heading[7, 4] = "85. AUD-CHF";
MP_Sub_Heading[7, 5] = "86. NZD-CHF";
MP_Sub_Heading[7, 6] = "87. CAD-CHF";
////----
////---- FOR USING IN INDICATOR --------------------------------------
////----
// 0-GBP PAIRS WITH BASE CURRENCY
MajorPair_Symbol[0, 0] = "GBPJPY";
MajorPair_Symbol[0, 1] = "GBPUSD";
MajorPair_Symbol[0, 2] = "GBPAUD";
MajorPair_Symbol[0, 3] = "GBPNZD";
MajorPair_Symbol[0, 4] = "GBPCAD";
MajorPair_Symbol[0, 5] = "GBPCHF";
MajorPair_Symbol[0, 6] = "EURGBP";
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-EURO PAIRS WITH BASE CURRENCY
MajorPair_Symbol[1, 0] = "EURUSD";
MajorPair_Symbol[1, 1] = "EURJPY";
MajorPair_Symbol[1, 2] = "EURGBP";
MajorPair_Symbol[1, 3] = "EURAUD";
MajorPair_Symbol[1, 4] = "EURNZD";
MajorPair_Symbol[1, 5] = "EURCAD";
MajorPair_Symbol[1, 6] = "EURCHF";
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 WITH BASE CURRENCY
MajorPair_Symbol[2, 0] = "USDJPY";
MajorPair_Symbol[2, 1] = "USDCAD";
MajorPair_Symbol[2, 2] = "USDCHF";
MajorPair_Symbol[2, 3] = "EURUSD";
MajorPair_Symbol[2, 4] = "GBPUSD";
MajorPair_Symbol[2, 5] = "AUDUSD";
MajorPair_Symbol[2, 6] = "NZDUSD";
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 WITH BASE CURRENCY
MajorPair_Symbol[3, 0] = "USDJPY";
MajorPair_Symbol[3, 1] = "GBPJPY";
MajorPair_Symbol[3, 2] = "EURJPY";
MajorPair_Symbol[3, 3] = "AUDJPY";
MajorPair_Symbol[3, 4] = "NZDJPY";
MajorPair_Symbol[3, 5] = "CADJPY";
MajorPair_Symbol[3, 6] = "CHFJPY";
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-AUD PAIRS WITH BASE CURRENCY
MajorPair_Symbol[4, 0] = "AUDJPY";
MajorPair_Symbol[4, 1] = "AUDUSD";
MajorPair_Symbol[4, 2] = "AUDNZD";
MajorPair_Symbol[4, 3] = "AUDCAD";
MajorPair_Symbol[4, 4] = "AUDCHF";
MajorPair_Symbol[4, 5] = "GBPAUD";
MajorPair_Symbol[4, 6] = "EURAUD";
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-NZD PAIRS WITH BASE CURRENCY
MajorPair_Symbol[5, 0] = "NZDUSD";
MajorPair_Symbol[5, 1] = "NZDJPY";
MajorPair_Symbol[5, 2] = "NZDCAD";
MajorPair_Symbol[5, 3] = "NZDCHF";
MajorPair_Symbol[5, 4] = "EURNZD";
MajorPair_Symbol[5, 5] = "GBPNZD";
MajorPair_Symbol[5, 6] = "AUDNZD";
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-CAD PAIRS WITH BASE CURRENCY
MajorPair_Symbol[6, 0] = "CADJPY";
MajorPair_Symbol[6, 1] = "CADCHF";
MajorPair_Symbol[6, 2] = "USDCAD";
MajorPair_Symbol[6, 3] = "EURCAD";
MajorPair_Symbol[6, 4] = "GBPCAD";
MajorPair_Symbol[6, 5] = "AUDCAD";
MajorPair_Symbol[6, 6] = "NZDCAD";
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-CHF PAIRS WITH BASE CURRENCY
MajorPair_Symbol[7, 0] = "CHFJPY";
MajorPair_Symbol[7, 1] = "USDCHF";
MajorPair_Symbol[7, 2] = "EURCHF";
MajorPair_Symbol[7, 3] = "GBPCHF";
MajorPair_Symbol[7, 4] = "AUDCHF";
MajorPair_Symbol[7, 5] = "NZDCHF";
MajorPair_Symbol[7, 6] = "CADCHF";
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;
///--------------------------------------------------------------
///----- ARRAYS STORES THE 2 x MAJOR PAIRS OF A SINGLE PAIRS
///---------------------------------------------------------------
///---- JPY PAIRS x 7 -------------------
MajorP_of_28Pair[0, 0] = "GBPJPY";
MajorP_of_28Pair[0, 1] = "GBP";
MajorP_of_28Pair[0, 2] = "JPY";
MajorP_of_28Pair[1, 0] = "USDJPY";
MajorP_of_28Pair[1, 1] = "USD";
MajorP_of_28Pair[1, 2] = "JPY";
MajorP_of_28Pair[2, 0] = "EURJPY";
MajorP_of_28Pair[2, 1] = "EUR";
MajorP_of_28Pair[2, 2] = "JPY";
MajorP_of_28Pair[3, 0] = "AUDJPY";
MajorP_of_28Pair[3, 1] = "AUD";
MajorP_of_28Pair[3, 2] = "JPY";
MajorP_of_28Pair[4, 0] = "NZDJPY";
MajorP_of_28Pair[4, 1] = "NZD";
MajorP_of_28Pair[4, 2] = "JPY";
MajorP_of_28Pair[5, 0] = "CADJPY";
MajorP_of_28Pair[5, 1] = "CAD";
MajorP_of_28Pair[5, 2] = "JPY";
MajorP_of_28Pair[6, 0] = "CHFJPY";
MajorP_of_28Pair[6, 1] = "CHF";
MajorP_of_28Pair[6, 2] = "JPY";
///---- EUR PAIRS x 6 -------------------
MajorP_of_28Pair[7, 0] = "EURUSD";
MajorP_of_28Pair[7, 1] = "EUR";
MajorP_of_28Pair[7, 2] = "USD";
MajorP_of_28Pair[8, 0] = "EURGBP";
MajorP_of_28Pair[8, 1] = "EUR";
MajorP_of_28Pair[8, 2] = "GBP";
MajorP_of_28Pair[9, 0] = "EURAUD";
MajorP_of_28Pair[9, 1] = "EUR";
MajorP_of_28Pair[9, 2] = "AUD";
MajorP_of_28Pair[10, 0] = "EURNZD";
MajorP_of_28Pair[10, 1] = "EUR";
MajorP_of_28Pair[10, 2] = "NZD";
MajorP_of_28Pair[11, 0] = "EURCAD";
MajorP_of_28Pair[11, 1] = "EUR";
MajorP_of_28Pair[11, 2] = "CAD";
MajorP_of_28Pair[12, 0] = "EURCHF";
MajorP_of_28Pair[12, 1] = "EUR";
MajorP_of_28Pair[12, 2] = "CHF";
///---- GBP PAIRS x 5 -------------------
MajorP_of_28Pair[13, 0] = "GBPUSD";
MajorP_of_28Pair[13, 1] = "GBP";
MajorP_of_28Pair[13, 2] = "USD";
MajorP_of_28Pair[14, 0] = "GBPAUD";
MajorP_of_28Pair[14, 1] = "GBP";
MajorP_of_28Pair[14, 2] = "AUD";
MajorP_of_28Pair[15, 0] = "GBPNZD";
MajorP_of_28Pair[15, 1] = "GBP";
MajorP_of_28Pair[15, 2] = "NZD";
MajorP_of_28Pair[16, 0] = "GBPCAD";
MajorP_of_28Pair[16, 1] = "GBP";
MajorP_of_28Pair[16, 2] = "CAD";
MajorP_of_28Pair[17, 0] = "GBPCHF";
MajorP_of_28Pair[17, 1] = "GBP";
MajorP_of_28Pair[17, 2] = "CHF";
///---- AUD PAIRS x 4 -------------------
MajorP_of_28Pair[18, 0] = "AUDUSD";
MajorP_of_28Pair[18, 1] = "AUD";
MajorP_of_28Pair[18, 2] = "USD";
MajorP_of_28Pair[19, 0] = "AUDNZD";
MajorP_of_28Pair[19, 1] = "AUD";
MajorP_of_28Pair[19, 2] = "NZD";
MajorP_of_28Pair[20, 0] = "AUDCAD";
MajorP_of_28Pair[20, 1] = "AUD";
MajorP_of_28Pair[20, 2] = "CAD";
MajorP_of_28Pair[21, 0] = "AUDCHF";
MajorP_of_28Pair[21, 1] = "AUD";
MajorP_of_28Pair[21, 2] = "CHF";
///---- NZD PAIRS x 3 -------------------
MajorP_of_28Pair[22, 0] = "NZDUSD";
MajorP_of_28Pair[22, 1] = "NZD";
MajorP_of_28Pair[22, 2] = "USD";
MajorP_of_28Pair[23, 0] = "NZDCAD";
MajorP_of_28Pair[23, 1] = "NZD";
MajorP_of_28Pair[23, 2] = "CAD";
MajorP_of_28Pair[24, 0] = "NZDCHF";
MajorP_of_28Pair[24, 1] = "NZD";
MajorP_of_28Pair[24, 2] = "CHF";
///---- USD PAIRS x 2 -------------------
MajorP_of_28Pair[25, 0] = "USDCAD";
MajorP_of_28Pair[25, 1] = "USD";
MajorP_of_28Pair[25, 2] = "CAD";
MajorP_of_28Pair[26, 0] = "USDCHF";
MajorP_of_28Pair[26, 1] = "USD";
MajorP_of_28Pair[26, 2] = "CHF";
///---- CAD PAIRS x 1 -------------------
MajorP_of_28Pair[27, 0] = "CADCHF";
MajorP_of_28Pair[27, 1] = "CAD";
MajorP_of_28Pair[27, 2] = "CHF";
////---------------------------------------------------
////---------------------------------------------------
/// GET SYMBOL PIP SIZE
Symbol t_Symbol;
double t_PipSize = 0, t_PipValue = 0;
// LOOP TO GET PIPSIZE
for (int i = 0; i < 28; i++)
{
// GET SYMBOL
t_Symbol = Get_28Pair_Symbol(i);
t_PipSize = t_Symbol.PipSize;
t_PipValue = t_Symbol.PipValue;
All_28_Pair_Symbol_Code[i] = t_Symbol.Code;
All_28_Pair_Pip_Size[i] = t_PipSize;
All_28_Pair_Pip_Value[i] = t_PipValue;
All_28_Pair_Ask_Price[i] = t_Symbol.Ask;
All_28_Pair_Bid_Price[i] = t_Symbol.Bid;
//Print((i+1).ToString() + ". " + t_Symbol.Code);
}
//END FOR
////---------------------------------------------------
////---------------------------------------------------
}
////---- END METHOD Initialize_Array_OnStart_Only()
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//// TimeFrameToShortName ///////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
private string TimeFrameToShortName(TimeFrame timeFrame)
{
string t_str = "";
if (timeFrame == TimeFrame.Minute)
{
t_str = "1min";
}
else if (timeFrame == TimeFrame.Minute2)
{
t_str = "2min";
}
else if (timeFrame == TimeFrame.Minute5)
{
t_str = "5min";
}
else if (timeFrame == TimeFrame.Minute10)
{
t_str = "10min";
}
else if (timeFrame == TimeFrame.Minute15)
{
t_str = "15min";
}
else if (timeFrame == TimeFrame.Minute20)
{
t_str = "20min";
}
else if (timeFrame == TimeFrame.Minute30)
{
t_str = "30min";
}
else if (timeFrame == TimeFrame.Minute45)
{
t_str = "45min";
}
else if (timeFrame == TimeFrame.Hour)
{
t_str = "1Hr";
}
else if (timeFrame == TimeFrame.Hour2)
{
t_str = "2Hr";
}
else if (timeFrame == TimeFrame.Hour4)
{
t_str = "4Hr";
}
else if (timeFrame == TimeFrame.Hour12)
{
t_str = "12Hr";
}
else if (timeFrame == TimeFrame.Daily)
{
t_str = "Daily";
}
else if (timeFrame == TimeFrame.Day2)
{
t_str = "Day2";
}
else if (timeFrame == TimeFrame.Day3)
{
t_str = "Day3";
}
else if (timeFrame == TimeFrame.Weekly)
{
t_str = "Wkly";
}
else if (timeFrame == TimeFrame.Monthly)
{
t_str = "Mnthly";
}
return t_str;
}
//END MEHTOD TimeFrameToShortName
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//// 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
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//// 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("EURJPY");
//break;
case 3:
return MarketData.GetSymbol("AUDJPY");
//break;
case 4:
return MarketData.GetSymbol("NZDJPY");
//break;
case 5:
return MarketData.GetSymbol("CADJPY");
//break;
case 6:
return MarketData.GetSymbol("CHFJPY");
//break;
//////////////////////////////////////////////
/// EUR PAIRS x 6
//////////////////////////////////////////////
case 7:
return MarketData.GetSymbol("EURUSD");
//break;
case 8:
return MarketData.GetSymbol("EURGBP");
//break;
case 9:
return MarketData.GetSymbol("EURAUD");
//break;
case 10:
return MarketData.GetSymbol("EURNZD");
//break;
case 11:
return MarketData.GetSymbol("EURCAD");
//break;
case 12:
return MarketData.GetSymbol("EURCHF");
//break;
//////////////////////////////////////////////
/// GBP PAIRS x 5
//////////////////////////////////////////////
case 13:
return MarketData.GetSymbol("GBPUSD");
//break;
case 14:
return MarketData.GetSymbol("GBPAUD");
//break;
case 15:
return MarketData.GetSymbol("GBPNZD");
//break;
case 16:
return MarketData.GetSymbol("GBPCAD");
//break;
case 17:
return MarketData.GetSymbol("GBPCHF");
//break;
//////////////////////////////////////////////
/// AUD PAIRS x 4
//////////////////////////////////////////////
case 18:
return MarketData.GetSymbol("AUDUSD");
//break;
case 19:
return MarketData.GetSymbol("AUDNZD");
//break;
case 20:
return MarketData.GetSymbol("AUDCAD");
//break;
case 21:
return MarketData.GetSymbol("AUDCHF");
//break;
//////////////////////////////////////////////
/// NZD PAIRS x 5
//////////////////////////////////////////////
case 22:
return MarketData.GetSymbol("NZDUSD");
//break;
case 23:
return MarketData.GetSymbol("NZDCAD");
//break;
case 24:
return MarketData.GetSymbol("NZDCHF");
//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_28Pair_Symbol
////////////////////////////////////////////////////////////////////////////
////---- Display_BOT_NAME ----////////////////////////////////
////////////////////////////////////////////////////////////////////////////
private void Display_BOT_NAME()
{
string t_Date = string.Format("{0:ddd-d-MMMM-y, H:mm tt }", Server.Time);
/// START DATE AND TIME
Draw_OnChart_C1("DBN1", 1, 14, "cBOT Start Date = " + t_Date, Clr_Heading_1);
///--- CBOT NAME INFO
Draw_OnChart_C1("DBN1", 2, 14, "cBOT : 28 Pair Volatility", Clr_Heading_2);
Draw_OnChart_C1("DBN1", 3, 14, "BY ///S.KHAN [skhan.projects@gmail.com]", Clr_Heading_2);
}
////---- END METHOD Display_BOT_NAME()
////////////////////////////////////////////////////////////////////////////////////////////////
//// Display_Input_Values_OnChart /////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////
private void Display_Input_Values_OnChart()
{
if (Flag_One_Time_01 == false)
{
int t_line = 4;
int t_Col = 32;
///--- USER INPUT VALUES
Draw_OnChart_C1("DBINv1", t_line - 1, t_Col, "USER INPUT SETTINGS", Clr_Heading_1);
//- VALUE #
//Draw_OnChart_C1("DBINv1", t_line + 0, t_Col, "TESTING", Clr_Heading_2);
//Draw_OnChart_C1("DBINv1", t_line + 1, t_Col, ">> " + Risk_Multiplier.ToString("0") + " <<", Clr_Warning);
//- VALUE #
t_line += 2;
//Draw_OnChart_C1("DBINv1", t_line + 0, t_Col, "New Trade : Time Frame to Compare Candles", Clr_Heading_2);
//Draw_OnChart_C1("DBINv1", t_line + 1, t_Col, "TF = " + p_Chart_TF, Clr_Heading_3);
///--- SET THE FLAG TO TRUE
Flag_One_Time_01 = true;
}
//END IF (Flag_One_Time_01 == false)
}
//END MEHTOD Display_Input_Values_OnChart
////////////////////////////////////////////////////////////////////////////
////---- Display_Color_Test ----////////////////////////////
////////////////////////////////////////////////////////////////////////////
private void Display_Color_Test()
{
int t_line = 36;
int t_line_02 = t_line;
int t_col = 32;
Draw_OnChart_C1("ColorTst", t_line - 1, t_col, "METHOD : COLOR DISPLAY TEST", Clr_Bk_1);
////---- COLORS DISPLAY TEST
Draw_OnChart_C1("ColorTst", t_line + 0, t_col, "Clr_Bk_1", Clr_Bk_1);
Draw_OnChart_C1("ColorTst", t_line + 1, t_col, "Clr_Heading_1", Clr_Heading_1);
Draw_OnChart_C1("ColorTst", t_line + 2, t_col, "Clr_Heading_2", Clr_Heading_2);
Draw_OnChart_C1("ColorTst", t_line + 3, t_col, "Clr_Heading_3", Clr_Heading_3);
t_line += 5;
Draw_OnChart_C1("ColorTst", t_line + 0, t_col, "Clr_PairListing", Clr_PairListing);
t_line += 2;
Draw_OnChart_C1("ColorTst", t_line + 0, t_col, "Clr_Positive", Clr_Positive);
Draw_OnChart_C1("ColorTst", t_line + 1, t_col, "Clr_Negative", Clr_Negative);
t_line += 2;
Draw_OnChart_C1("ColorTst", t_line + 0, t_col, "Clr_True", Clr_True);
Draw_OnChart_C1("ColorTst", t_line + 1, t_col, "Clr_False", Clr_False);
t_line += 2;
Draw_OnChart_C1("ColorTst", t_line + 0, t_col, "Clr_Signal_Buy", Clr_Signal_Buy);
Draw_OnChart_C1("ColorTst", t_line + 1, t_col, "Clr_Signal_Sell", Clr_Signal_Sell);
// RESET
t_line = t_line_02;
t_col = t_col + 3;
Draw_OnChart_C1("ColorTst", t_line + 0, t_col, "Clr_Value_01", Clr_Value_01);
Draw_OnChart_C1("ColorTst", t_line + 1, t_col, "Clr_Value_02", Clr_Value_02);
t_line += 2;
Draw_OnChart_C1("ColorTst", t_line + 0, t_col, "Clr_Border_01", Clr_Border_01);
Draw_OnChart_C1("ColorTst", t_line + 1, t_col, "Clr_Border_02", Clr_Border_02);
t_line += 2;
Draw_OnChart_C1("ColorTst", t_line + 0, t_col, "Clr_Signal_Hold", Clr_Signal_Hold);
Draw_OnChart_C1("ColorTst", t_line + 1, t_col, "Clr_Signal_Neutral", Clr_Signal_Ntrl);
t_line += 2;
Draw_OnChart_C1("ColorTst", t_line + 1, t_col, "Clr_Warning", Clr_Warning);
}
////---- END METHOD Display_Color_Test()
////////////////////////////////////////////////////////////////////////////
////---- Play_Sound_on_Signal ----//////////////////
////////////////////////////////////////////////////////////////////////////
private void Play_Sound_on_Signal()
{
if (p_MediaFile != string.Empty && p_Sound_ALerts_ON_OFF == 1)
Notifications.PlaySound(p_MediaFile);
}
////---- END METHOD Play_Sound_on_Signal()
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//// 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();
//tstr_1 = t_PreFix + Line_No.ToString();
ChartObjects.DrawText(tstr_1, my_NL(Line_No) + my_Tabs(Tab_Pos) + t_text, StaticPosition.TopLeft, Draw_Color);
}
//END METHOD Draw_OnChart_C1
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
private void Draw_OnChart_C2(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;
ChartObjects.DrawText(tstr_1, my_NL(Line_No) + my_Tabs(Tab_Pos) + t_text, StaticPosition.TopLeft, Draw_Color);
}
//END METHOD Draw_OnChart_C2
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
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 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 COL #
int k = 1;
for (int i = 0; i <= 50; i++,k++)
{
t_text = "C#";
t_text = t_text + "." + k.ToString();
Draw_OnChart_C1("Col", 0, (i), t_text, Clr_Bk_1);
}
//END FOR
}
//END METHOD Display_RowColumn
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
private void Display_Vertical_Lines(int t_Start_Line, int t_Stop_Line, int t_Col, Colors Clr_01)
{
//FIRST LOOP
for (int i = t_Start_Line; i <= t_Stop_Line; i++)
{
Draw_OnChart_C1("VL" + i.ToString(), i, t_Col - 1, " ||", Clr_01);
}
//END FOR
}
//END FUNCTION Display_Vertical_Lines
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
private void Display_Horizontal_Lines(int t_Line, int t_Start_Col, int t_Stop_Col, Colors Clr_01)
{
//FIRST LOOP
for (int i = t_Start_Col; i < t_Stop_Col; i++)
{
Draw_OnChart_C1("HL" + i.ToString(), t_Line, i, "=======", Clr_01);
if (i == t_Stop_Col - 1)
Draw_OnChart_C1("HL" + i.ToString(), t_Line, i, "=========", Clr_01);
}
//END FOR
}
//END FUNCTION Display_Horizontal_Lines
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
private void Display_TABLE()
{
//Display_Vertical_Lines(6, 53, 2, Clr_Border_02);
///-- SEPARATION LINE BETWEEN % OF T-Pips AND % OF Hi2Lo
//Display_Vertical_Lines(12, 40, 34, Clr_Border_02);
//Display_Vertical_Lines(6, 53, 7, Clr_Border_02);
}
//END FUNCTION Display_TABLE
}
//END MAIN PUBLIC CLASS
}
//END MAIN cALGO ROBOT
GoldnOil750
Joined on 07.04.2015
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: SK1_Volatality_28Pairs.algo
- Rating: 5
- Installs: 2993
- Modified: 13/10/2021 09:54
Comments
Hi S.Khan,
Thanks for putting this code up.
When I try to run I'm getting the error 'cAlgo\Sources\Indicators\MajorPair_Total_Pips_Single_Pair_ATR\MajorPair_Total_Pips_Single_Pair_ATR\MajorPair_Total_Pips_Single_Pair_ATR.csproj doesn't exist.'
The project for this indicator is not in the install file. How can I get this indicator.
Cheers,
Mark
very great cbot... i have loaded it in default setting....
please mention
first colomn is
15 min hi-lo volit = (15 min candles high-low?) or its for 1 min?
p=4 4 hour atr= (4 hour atr?) or 15 minutes atr--- and atr is of 14 periods?
4 hour Tpips=?
t pips/atr 1 hour=?
t pips/atr 4 hour=?
in short, what each column denotes for.. please help me
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.
hi
thank you for this great work, very technical ...
it just lacks the opening of a command so that this robot is the most remarkable ....
do you have an example or a piece of code adapted to your logic that allows to open and close an order automatically.
cordially
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.
So when it will give an order ?
Many places give away free beds or mattresses for low-income families, and if they cannot give them to you for free, they will provide you with outstanding discounts so that you can afford the beds.