How to draw a simple line from the 50th candle from last to second last candle?
How to draw a simple line from the 50th candle from last to second last candle?
Loading saved threads...
coure2011 · External communityPost link
External question — Stack Overflow Stack Exchange
Author: coure2011
Original post: https://stackoverflow.com/questions/78732259
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
I am not able to get the idea how to provide the time correctly to draw a line. I tried like
ObjectCreate('line', OBJ_HLINE, 0, 0, 2100);
which is drawing a line at the value of 2100, but it starts from 0 and spreads to the right end unlimited. How to draw the line starting from the 50th candle from last till the second last candle?
I also tried
ObjectCreate('line', OBJ_HLINE, 0, Time[50], 2100, Time[1], 2100);
Quote
Report
Mark SdS · External communityPost link
External answer — Stack Overflow Stack Exchange
Author: Mark SdS
Original post: https://stackoverflow.com/a/78741831
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
You'll need a trend line and switch off the ray.
//assign parameters (2 moments in time, 2 prices (equal for Horizontal), **unique** name)
double price1 = 2100;
double price2 = price1;
datetime time1 = iTime(0,0,50);
datetime time2 = iTime(0,0,1);
string name = "nameOnceUsedIsInvaladidForNextLinesToBeNamed";
//create the line
ObjectCreate(ChartID(),name,OBJ_TREND,0,time1,price1,time2,price2);
//switch off the ray
ObjectSetInteger(ChartID(),name,OBJPROP_RAY,false);
Quote
Report
4xPip Official · External communityPost link
External answer — Stack Overflow Stack Exchange
Author: 4xPip Official
Original post: https://stackoverflow.com/a/79199860
License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/
Adaptation: HTML converted to plain text; contact email addresses removed.
This function will help you draw the Horizontal Line From the 50th candle to the 2nd last candle.
void drawTrendLine()
{
datetime time1 = Time[50];
double price1 = Close[50];
datetime time2 = Time[1];
double price2 = Close[50];
ObjectDelete(ChartID(), "CustomTrendLine"); // Delete the object if already exist
ObjectCreate(ChartID(),"CustomTrendLine",OBJ_TREND,0,time1,price1,time2,price2);
ObjectSetInteger(ChartID(),"CustomTrendLine",OBJPROP_RAY_RIGHT,false);
}
Quote
Report
Post Reply
Quoted from Forex.com.bd-Editorial External question — Stack Overflow Stack Exchange Author: coure2011 Source score (net votes, not local likes): 0 Original post: https://stackoverflow.com/questions/78732259 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. I am not able to get the idea how to provide the time correctly to draw a line. I tried like ObjectCreate('line', OBJ_HLINE, 0, 0, 2100); which is drawing a line at the value of 2100, but it starts from 0 and spreads to the right end unlimited. How to draw the line starting from the 50th candle from last till the second last candle? I also tried ObjectCreate('line', OBJ_HLINE, 0, Time[50], 2100, Time[1], 2100);
Checking account access…