Coding help - page 413

 

hi dear mr. tools and mladen

As you know the "nihilist_ultra_adx.mq4" is an indicator that shows adx slope by 4 color .

would you please change its coding so that shows +di slope by colors ?

happy new year and thanks a lot in advance .

 

Hi Coders,

Happy new year all. lots, Lots, lot's of coding pips! lool

Here is the code:

"

//+-----------------------------------------------------------------------------------------------

if ( TrendLine1_Red) // for Sell

ObjectCreate("TrendLine1_Red", OBJ_TREND, 0, Time[12], Bid-100*Point , Time[0]+3600, Bid-100*Point );

ObjectSet("TrendLine1_Red", OBJPROP_COLOR, Red);

if (ObjectFind("sell_line")==-1)

{ ObjectCreate("sell_line",OBJ_TEXT, 0, 0, 0); }

ObjectSetText("sell_line",DoubleToStr(MathAbs((NormalizeDouble(Bid,Digits)-NormalizeDouble

(ObjectGetValueByShift("TrendLine1_Red "+1,0),Digits))*MathPow(10,Digits)),0),8,"Arial",Red);

ObjectSet("sell_line",OBJPROP_PRICE1,NormalizeDouble(ObjectGetValueByShift("TrendLine1_Red "+1,0),Digits));

ObjectSet("sell_line",OBJPROP_TIME1,Time[0]) ;

double val1=ObjectGetValueByShift("TrendLine1_Red", 0);

//+-----------------------------------------------------------------------------------------------

Question:

What should I change with that code to enter the market at the present candle and not at the previous candle?

My goal is to enter the market right away without waiting for the next candle.

Thank a lot. Thanks a Lot. well, thanxs...

Have a great year.

Tomcat98

 
Tomcat98:
Hi Coders,

Happy new year all. lots, Lots, lot's of coding pips! lool

Here is the code:

"

//+-----------------------------------------------------------------------------------------------

if ( TrendLine1_Red) // for Sell

ObjectCreate("TrendLine1_Red", OBJ_TREND, 0, Time[12], Bid-100*Point , Time[0]+3600, Bid-100*Point );

ObjectSet("TrendLine1_Red", OBJPROP_COLOR, Red);

if (ObjectFind("sell_line")==-1)

{ ObjectCreate("sell_line",OBJ_TEXT, 0, 0, 0); }

ObjectSetText("sell_line",DoubleToStr(MathAbs((NormalizeDouble(Bid,Digits)-NormalizeDouble

(ObjectGetValueByShift("TrendLine1_Red "+1,0),Digits))*MathPow(10,Digits)),0),8,"Arial",Red);

ObjectSet("sell_line",OBJPROP_PRICE1,NormalizeDouble(ObjectGetValueByShift("TrendLine1_Red "+1,0),Digits));

ObjectSet("sell_line",OBJPROP_TIME1,Time[0]) ;

double val1=ObjectGetValueByShift("TrendLine1_Red", 0);

//+-----------------------------------------------------------------------------------------------

Question:

What should I change with that code to enter the market at the present candle and not at the previous candle?

My goal is to enter the market right away without waiting for the next candle.

Thank a lot. Thanks a Lot. well, thanxs...

Have a great year.

Tomcat98

Tomcat98

From that code snippet it is impossible to see when do you enter the market at all (all that I see is that you are using ObjectGetValueByShift() for some trend lines the current bar, but other than that no attempt of opening an order is visible)

 

Mladen,

Well,

here is it: (for sell)

"

int res;

double val1=ObjectGetValueByShift("TrendLine1_Red", 0);

if ( bid < val1 )

{

res=OrderSend(Symbol(),OP_SELL,LotsOptimized(),Bid,1,0,0,"",MAGIC,0,Red);

}

"

The code is always waiting for the next candle, not the live one to enter the market.

Wondering.

Thanks

Tomcat98

 
Tomcat98:
Mladen,

Well,

here is it: (for sell)

"

int res;

double val1=ObjectGetValueByShift("TrendLine1_Red", 0);

if ( bid < val1 )

{

res=OrderSend(Symbol(),OP_SELL,LotsOptimized(),Bid,1,0,0,"",MAGIC,0,Red);

}

"

The code is always waiting for the next candle, not the live one to enter the market.

Wondering.

Thanks

Tomcat98

What is the value of "bid" (that is not the built in Bid value) and when is it acquired?

 
mladen:
What is the value of "bid" (that is not the built in Bid value) and when is it acquired?

Nice shot Mladen:

Neurons at work at the start of this new year.

I have changed :

double bid = (Bid);

into

bid =MarketInfo(Symbol(),MODE_BID); // Request for the value of Bid

and

Time[0]+3600

into

TimeCurrent()

Seems to work ok now.

Thanks a lot .

Have a good WE

Sincerely

Tomcat98

 

Guys who can help, make, please, background on TMA and MaxBarsBack. Pleasssse!!!!!

 
v2812:
Guys who can help, make, please, background on TMA and MaxBarsBack. Pleasssse!!!!!

What background are you talking about?

 

Hi Mladen! Something like this

Files:
maribbon.gif  34 kb
 

hello,

I have a big request could someone make this script working "on click" instead of "drag & drop"? you need to drag and drop this script on candle to make it working, but I would like to enable or disable this script by clicking on candle

thank you very much in advance

Files:
Reason: