How do i call this indicator? - mql4

input int BackLimit = 10000;
input int TimeFrame = 0;
input string TimeString = "0=Current, 15=M15, 30=M30, 60=H1, 240=H4, 1440=Day, 10080=Week, 43200=Month";
input string SHOW_ZONES = "==========SHOW ZONES==========";
input bool zone_show_untested = true;
input bool zone_show_verified = true;
input bool zone_show_truncoat = true;
input bool zone_show_weak = false;
input bool zone_show_possible = false;
input bool zone_showbroken = false;
input string ZONE_ALERTS = "==========ZONE ALERTS==========";
input bool zone_show_alerts = true;
input bool zone_alert_popups = true;
input bool zone_alert_sounds = true;
input bool send_email = false;
input bool use_push = false;
input int zone_alert_waitseconds = 300;
input string ZONE_ALERTS_FILTER = "==========FILTER ALERTS==========";
input bool filter_zone_alert = true;
input bool filter_MA = true;
input int TF_MA = 60;
input int MA_FAST_PERIOD = 13;
input int MA_FAST_METHOD = 1;
input int MA_SLOW_PERIOD = 48;
input int MA_SLOW_METHOD = 1;
input string STYLE_ZONES = "==========STYLE ZONES==========";
input bool zone_merge = true;
input bool zone_extend = false;
input bool zone_solid = false;
input int zone_linewidth = 1;
input int zone_style = 0;
input int ShiftEndRight = 3;//extend the end of zones 3 bars beyond last bar
input int zone_limit = 1000;
input bool zone_show_info = true;
input bool zone_show_size = true;
input int zone_label_shift = 3;
input color color_label = clrWhite; //Label color
input string font_label = "Courier New"; //Label Font
input int size_label = 9; //Label size
input string ZONES_COLOR = "==========COLOR ZONES==========";
input color color_support_possible = DarkSlateGray;
input color color_support_untested = SeaGreen;
input color color_support_verified = Green;
input color color_support_weak = LimeGreen;
input color color_support_turncoat = OliveDrab;
input color color_resist_possible = Indigo;
input color color_resist_untested = Orchid;
input color color_resist_verified = Crimson;
input color color_resist_weak = Red;
input color color_resist_turncoat = DarkOrange;
input color color_broken_weak = DarkGray;
input color color_broken_verified = Gray;
input color color_broken_other = DimGray;
input string ZONE_FRACTALS = "==========ZONE FRACTALS==========";
input double zone_fuzzfactor = 0.75;
input bool fractals_show = false;
input double fractal_fast_factor = 3.0;
input double fractal_slow_factor = 6.0;
input string ZONES_GLOBAL_VAR = "==========ZONES GLOBAL VARIABLES==========";
input bool SetGlobals = False;
input string ZONES_TESTING_MODE = "==========ZONES TESTING==========";
input bool Testing = false; //TRUE == scrolling back the chart shows PAST zone "look"
input bool ShowTestingBtn = false; //Show button to switch Testing mode On/Off
input int TestingBtnX = 10; //Position of this button
input int TestingBtnY = 120;
double lineOne = iCustom(_Symbol,_Period,"SS_SupportResistance_v07.53 (filter alerts MA)",BackLimit,TimeFrame,TimeString, SHOW_ZONES,zone_show_untested,zone_show_verified,zone_show_truncoat,zone_show_weak,zone_show_possible,zone_showbroken,ZONE_ALERTS,zone_show_alerts,zone_alert_popups,zone_alert_sounds,send_email,use_push,zone_alert_waitseconds,ZONE_ALERTS_FILTER,filter_zone_alert,filter_MA,TF_MA,MA_FAST_PERIOD,MA_FAST_METHOD,MA_SLOW_PERIOD,MA_SLOW_METHOD,STYLE_ZONES,zone_merge,zone_extend,zone_solid,zone_linewidth,zone_style,ShiftEndRight,zone_limit,zone_show_info,zone_show_size,zone_label_shift,color_label,font_label,size_label,ZONES_COLOR,color_support_possible,color_support_untested,color_support_verified,color_support_weak,color_support_turncoat,color_resist_possible,color_resist_untested,color_resist_verified,color_resist_weak,color_resist_turncoat,color_broken_weak,color_broken_verified,color_broken_other,ZONE_FRACTALS,zone_fuzzfactor,fractals_show,fractal_fast_factor,fractal_slow_factor,ZONES_GLOBAL_VAR,SetGlobals,ZONES_TESTING_MODE,Testing,ShowTestingBtn,TestingBtnX,TestingBtnY,0,1);
Print("The number is ",lineOne);
These are the inputs of the indicator i want to call. I have done similar calling for another indicator and it worked. This specific indicator is giving "wrong parameter count" error. After calling the indicator inputs, the zero, the second to the last parameter represent the line with buffer 0, while the 1 which is the last parameter represent the last candle. Please what could wrong. Thank you for your help.

cause the inputSettings have Placeholders like: "==========BLABLABLA==========";
u need to adjust ur iCustom call everytime when u have Placeholder like that u need to put a "0" in ur iCustom function call
pls like if it helps

Related

Format cell color based on the cell text content

I want to accomplish something like this:
I have a sort of "Relational" Spreadsheet, and I want rows to be colored according.
I manually choosing a unique color for each Category on the "Categories" Sheet or generating a unique color based on the string content, either would work for my use case.
Not the best solution but it works
function onEdit(e) {
if(e){
var ss = e.source.getActiveSheet();
var range = e.source.getActiveRange();
var r1 = range.getRow();
var c1 = range.getColumn();
var rowsCount = range.getNumRows();
for(var i=0; i<rowsCount; i++){
var row = ss.getRange(r1+i,1,1,ss.getMaxColumns());
updateRow(row, ss);
}
}
}
function updateRow(row, ss){
if (ss.getName() == "Entries") { // This is the sheet name
var cell = row.getCell(1,1);
var firstCellValue = cell.getValue();
if(firstCellValue){
cell.setBackgroundColor(stringToColor(firstCellValue));
}
else{
cell.setBackgroundColor(null);
}
}
}
function stringToColor(str) {
var hash = 0;
for (var i = 0; i < str.length; i++) {
hash = str.charCodeAt(i) + ((hash << 5) - hash);
}
var colour = '#';
for (var i = 0; i < 3; i++) {
var value = (hash >> (i * 8)) & 0xFF;
colour += ('00' + value.toString(16)).substr(-2);
}
return colour;
}
Based on this answer
in conditional formatting select the range you want to apply colors, select color, choose Text is exactly and set value:

Dart convert int variable to string

I'm trying to convert an integer variable
var int counter = 0;
into a string variable
var String $counter = "0";
I searched but I only found something like
var myInt = int.parse('12345');
that doesn't work with
var myInt = int.parse(counter);
Use toString and/or toRadixString
int intValue = 1;
String stringValue = intValue.toString();
String hexValue = intValue.toRadixString(16);
or, as in the commment
String anotherValue = 'the value is $intValue';
// String to int
String s = "45";
int i = int.parse(s);
// int to String
int j = 45;
String t = "$j";
// If the latter one looks weird, look into string interpolation on https://dart.dev
You can use the .toString() function in the int class.
int age = 23;
String tempAge = age.toString();
then you can simply covert integers to the Strings.

Integers Larger than Int64

I'm attempting to get a user input number and find the sum of all the digits. I'm having issues with larger numbers, however, as they won't register under an Int64. Any idea as to what structures I could use to store the value? (I tried UInt64 and that didn't work very well with negatives, however, I'd prefer something larger than UInt64, anyways. I'm having a hard time implementing a UInt128 from Is there a number type with bigger capacity than u_long/UInt64 in Swift?)
import Foundation
func getInteger() -> Int64 {
var value:Int64 = 0
while true {
//we aren't doing anything with input, so we make it a constant
let input = readLine()
//ensure its not nil
if let unwrappedInput = input {
if let unwrappedInt = Int64(unwrappedInput) {
value = unwrappedInt
break
}
}
else { print("You entered a nil. Try again:") }
}
return value
}
print("Please enter an integer")
// Gets user input
var input = getInteger()
var arr = [Int] ()
var sum = 0
var negative = false
// If input is less than 0, makes it positive
if input < 0 {
input = (input * -1)
negative = true
}
if (input < 10) && (input >= 1) && (negative == true) {
var remain = (-1)*(input%10)
arr.append(Int(remain))
input = (input/10)
}
else {
var remain = (input%10)
arr.append(Int(remain))
input = (input/10)
}
}
// Adds numbers in array to find sum of digits
var i:Int = 0
var size:Int = (arr.count - 1)
while i<=size {
sum = sum + arr[i]
i = (i+1)
}
// Prints sum
print("\(sum)")
You can use a string to perform the operation you describe. Loop through each character and convert it to an integer and add to the sum. Be careful to handle errors.

Create Excel WITHOUT using INTEROP in c# window service

Can any1 explain how we can create Excel WITHOUT using INTEROP in c# window service.
So that I can apply styles also to the generating excel as I wish.
Rigin
You can use one of the Excel libraries. I use this C# Excel library.
See also this sample of code:
http://www.easyxls.com/manual/FAQ/export-to-excel-in-dot-net.html
You can create both XLS or XLSX documents.
You can create excel in windows services like below:
public static void GenerateExcel(DataTable DT, string fullFileName, string rptHeader, string SheetName)
{
try
{
var file = new FileInfo(fullFileName);
string currentFileName = System.IO.Path.GetFileName(fullFileName);
ExcelPackage excel = new ExcelPackage(file);
var sheetcreate = excel.Workbook.Worksheets.Add("Sheet1");
//rptHeader = getCaption(rptHeader);
char c = 'A';
c = (char)(((int)c) + DT.Columns.Count - 1);
//sheetcreate.Cells["A1:" + c+"1"].Value = rptHeader;
sheetcreate.Cells["A1:D1"].Value = rptHeader;
sheetcreate.Cells["A1:" + c + "1"].Style.Fill.PatternType = ExcelFillStyle.Solid;
//sheetcreate.Cells["A1:" + c + "1"].Style.Fill.BackgroundColor.SetColor(System.Drawing.ColorTranslator.FromHtml("#c6c6c6"));
sheetcreate.Cells[1, 1, 1, DT.Columns.Count].Merge = true;
sheetcreate.Cells[1, 1, 1, DT.Columns.Count].Style.Font.Bold = true;
int col = 0;
foreach (DataColumn column in DT.Columns)
{
sheetcreate.Cells[2, ++col].Value = column.ColumnName;
sheetcreate.Cells[2, col].Style.Font.Bold = true;
sheetcreate.Cells[2, col].Style.Border.BorderAround(OfficeOpenXml.Style.ExcelBorderStyle.Thin);
sheetcreate.Cells[2, col].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
}
if (DT.Rows.Count > 0)
{
int row = 2;
for (int eachRow = 0; eachRow < DT.Rows.Count; ) //looping each row
{
bool havingText = false;
for (int eachColumn = 1; eachColumn <= col; eachColumn++) //looping each column in a row
{
var eachRowObject = sheetcreate.Cells[row + 1, eachColumn];
eachRowObject.Style.Fill.PatternType = ExcelFillStyle.Solid;
eachRowObject.Value = DT.Rows[eachRow][(eachColumn - 1)].ToString();
if (!havingText) //checking if 'totoa' in string and setting up 'havingText' variable to color it differently
havingText = DT.Rows[eachRow][(eachColumn - 1)].ToString().ToLower().Contains("total");
//Making all cell value to left align
eachRowObject.Style.HorizontalAlignment = ExcelHorizontalAlignment.Left;
//if (CL.isDecimal(DT.Rows[eachRow][(eachColumn - 1)].ToString())) //if it is number with decimal value make it right align
//{
// eachRowObject.Style.HorizontalAlignment = ExcelHorizontalAlignment.Right;
//}
//eachRowObject.Style.Border.BorderAround(OfficeOpenXml.Style.ExcelBorderStyle.Thin); // adding border to each cells
//if (eachRow % 2 == 0) //alternatively adding color to each cell.
// eachRowObject.Style.Fill.BackgroundColor.SetColor(System.Drawing.ColorTranslator.FromHtml("#e0e0e0"));
//else
// eachRowObject.Style.Fill.BackgroundColor.SetColor(System.Drawing.ColorTranslator.FromHtml("#ffffff"));
}
if (havingText) //if any cell data containt 'total' color complete.
{
for (int eachColumn = 1; eachColumn <= col; eachColumn++)
{
sheetcreate.Cells[row + 1, eachColumn].Style.Fill.PatternType = ExcelFillStyle.Solid;
//sheetcreate.Cells[row + 1, eachColumn].Style.Fill.BackgroundColor.SetColor(System.Drawing.ColorTranslator.FromHtml("#86a9ef"));
}
}
eachRow++;
row++;
}
getLog("batch controller: in loop");
}
getLog("batch controller: 485");
sheetcreate.Cells.AutoFitColumns();
excel.Save();
}
catch (Exception e)
{
getLog("Error while generating excel=>"+e);
}
}
You can download EPPlus from : https://www.nuget.org/packages/EPPlus/

Embed Text in Shape

I would like to embed some text into a circle in ActionScript. I have three problems: I can't get the text to center in the circle, I can't get the text to be center aligned, and I can't get the font to be applied to the text. Regarding the font, I know that it is embedded correctly, as it works on TextFields I create on the stage.
[Embed(source="DAXCOMPL.TTF", fontName="DaxCompact-Light", mimeType='application/x-font', embedAsCFF='false')]
private var MyFont:Class;
public function Bubble(...) {
var myFont:Font = new MyFont();
var myFormat:TextFormat = new TextFormat();
myFormat.size = 20;
myFormat.align = TextFormatAlign.CENTER;
myFormat.font = myFont.fontName;
var circle:Sprite = new Sprite();
var r:int = 30;
var text:TextField = new TextField();
text.text = "Hello world!";
text.wordWrap = true;
text.defaultTextFormat = myFormat;
text.autoSize = TextFieldAutoSize.LEFT;
text.x = -30;
text.y = -30;
circle.graphics.lineStyle(2, 0x000000, 1.0);
circle.graphics.drawCircle(0,0,r);
circle.graphics.endFill();
circle.addChild(text);
circle.x = 75;
circle.y = 450;
addChild(circle);
}
try to initalize the textfield this way:
var text:TextField = new TextField();
text.embedFonts = true; // use embedded font
text.defaultTextFormat = myFormat; // use this command before setting text
text.text = "Hello world!";
text.wordWrap = true;
text.autoSize = TextFieldAutoSize.LEFT;
text.x = -text.textHeight*0.5; //center the textfield after setting text
text.y = -text.textWidth*0.5;

Resources