Re: Coding Help

541
Dear mladen

Please, be so kind as to review my copycat code:
I've made a function to change the color of the candles, but my gut is telling me that it can be made in simpler way...
anyway, show me the way...
thanks

void SetCandleColor(int col, double& upw[], double& upc[], double& dnw[], double& dnc[], int i)
{
double high,low,bodyHigh,bodyLow;


{
bodyHigh = MathMax(Open,Close);
bodyLow = MathMin(Open,Close);
high = High;
low = Low;
}

upw = low; upc = bodyLow;
dnw = low; dnc = bodyLow;


switch(col)
{
case 1: upw[i] = high; upc[i] = bodyHigh; break;
case -1: dnw[i] = high; dnc[i] = bodyHigh; break;

}
}


Re: Coding Help

543
knaimad wrote: Sun Oct 22, 2017 9:28 am Dear mladen

Please, be so kind as to review my copycat code:
I've made a function to change the color of the candles, but my gut is telling me that it can be made in simpler way...
anyway, show me the way...
thanks

Code: Select all

void SetCandleColor(int col, double& upw[], double& upc[], double& dnw[], double& dnc[], int i)
{
	double high,low,bodyHigh,bodyLow;


	{
		bodyHigh = MathMax(Open[i],Close[i]);
		bodyLow  = MathMin(Open[i],Close[i]);
		high          = High[i];
		low		  = Low[i];
	}

	upw[i] = low;	upc[i] = bodyLow;
	dnw[i] = low;	dnc[i] = bodyLow;
	

	switch(col)
	{
		case  1: 	upw[i] = high;	upc[i] = bodyHigh;	break;
		case -1: 	dnw[i] = high;	dnc[i] = bodyHigh;	break;
	
	}
}
or maybe the below is tad better?

Code: Select all

void SetCandleColor(double& _trend[], double& _upwick[], double& _dnwick[], double& _upbody[], double& _dnbody[], int i)
{
            if (_trend[i]== 1)
            {
               _upbody[i] = MathMax(Open[i],Close[i]);
               _dnbody[i] = MathMin(Open[i],Close[i]);
               _upwick[i] = High[i];
               _dnwick[i] = Low[i];
            };
            
            if (_trend[i]==-1)
            {
               _upbody[i] = MathMin(Open[i],Close[i]);
               _dnbody[i] = MathMax(Open[i],Close[i]);
               _dnwick[i] = High[i];
               _upwick[i] = Low[i];
            };
}


Re: Coding Help

546
Hello, I am trying to code tw indicators out of which one works and other doesnt. Is is very simple. I want 1st indicator to show up ticks and down ticks seperately and in second I want to see the difference of upticks and downticks in present candle from previous candle.

For the 1st one I use

UpTicks=(Volume+(Close-Open)/Point)/2;
DownTicks=-Volume+UpTicks;

And I can plot the two histograms and it runs fine.

For the second one I add this to above:

DUpTicks=UpTicks-UpTicks[i-1];
DDownTicks=DownTicks[i]-DownTicks[i-1];

But unfortunately I cannot plot the histogram. Any idea whats the right way to do it?

Thanks
Know Thy Setup. Know Thyself.

Re: Coding Help

547
Здравствуйте. В прилагаемом ниже скрипте при показателе 0 но выставляет TP SL по всем ордерам 0. А было бы лучше если бы при показателе 0 он бы бездействовал. В общем суть запроса в том, что бы можно было отключать при желании TP или SL. Помогите пожалуйста, подправьте скрипт.

Re: Coding Help

548
shaileshm wrote: Tue Nov 07, 2017 6:39 pm Hello, I am trying to code tw indicators out of which one works and other doesnt. Is is very simple. I want 1st indicator to show up ticks and down ticks seperately and in second I want to see the difference of upticks and downticks in present candle from previous candle.

For the 1st one I use

UpTicks=(Volume+(Close-Open)/Point)/2;
DownTicks=-Volume+UpTicks;

And I can plot the two histograms and it runs fine.

For the second one I add this to above:

DUpTicks=UpTicks-UpTicks[i-1];
DDownTicks=DownTicks[i]-DownTicks[i-1];

But unfortunately I cannot plot the histogram. Any idea whats the right way to do it?

Thanks


I am wondering why my code has changed. Anyways what is working is this

Code: Select all

UpTicks[i]=(Volume[i]+(Close[i]-Open[i])/Point)/2;
DownTicks[i]=-Volume[i]+UpTicks[i];
This obviously plots the upticks and downticks seperately which I want. But now I also want to see the difference of upticks of current candle to the previous one, and the difference of downtick of current candle to the downticks of previous one. Foe this I have added the following lines

Code: Select all

DUpTicks[i]=UpTicks[i]-UpTicks[i-1];
DDownTicks[i]=DownTicks[i]-DownTicks[i-1];
which does not plot anything. I would like someone to help me put the correct code.

Thanks and regards.
Know Thy Setup. Know Thyself.

Re: Coding Help

549
Hi Mladen, thanks for your superb contributions over the years.
I'm trying to add a display price to this indicator, but I lost it... I don't have enough skills to do it (tried and tried but I always get erros in the end).
The indicator is somehow old; LauncherDirectionalIndicator, kind of a channel with MA's.
I found a decompiled version on the web, which I'm attaching.
I kindly ask you, if, with your skills, you can add the display price to the lines as indicated on the screenshot.

Many thanks for your help and many blessings.

Cheers.

Re: Coding Help

550
Can someone kindly examine this code. It is supposed to draw a horizontal line for highest and lowest for each of 6 time periods eg. 1 months, 2months etc. For some reason it draws five of the six low lines and that is all. I've been pulling my hair out (metaphor) trying to resolve this and I am asking for help / someone to see my errors / what I have overlooked and get it working as envisaged.


Who is online

Users browsing this forum: No registered users and 19 guests