Re: Coding Help - Finding Digital Root Source Numbers with MathMod

#1201
global wrote:
Tue Jan 05, 2021 1:27 pm
Hi Mladen and all,

I searched all over trying to find out how to use MathMod or some other related code to find Digital Root Source Numbers but so far I found nothing so I hope you all can help.

I'm experimenting using MathMod to find the digital roots between numbers 1-9 of prices and that works perfectly with this line of code:

DigitalRoot = MathRound(1+MathMod((Price/points*10)-1,9));

For simplicity in the test code below I just used a starting non-decimal number instead of a price, incremented the original number by 9 and printed that list of 10 numbers along with their digital roots. Since digital roots don't change by adding 9, all the digital roots of the 10 numbers are 4. However, the last 2-digit source numbers for each of those 10 numbers are sometimes different. For a digital root of 4, the last source two-digit numbers can be either 13, 22 or 40, so my question is, can the MathMod function be used in any way or with some other functions to find those final previous two-digit source numbers instead of the single-digit final dgital root? If MathMod can be used in this way together with some other functions then can someone please help and explain how this can be done? Thank you very much.

Here is the test code I wrote that prints out a comment list of 10 numbers and their digital roots. I would like to see the previous two-digit source numbers of their digital roots calculated and listed as well but I couldn't figure out how to do it.

double Number=1570;
double DigitalRoot=0;

string List="";
for(int k=0; k<11; k++)
{
DigitalRoot = MathRound(1+MathMod((Number+(9*k))-1,9));
List=StringConcatenate(List, k," Number: ", Number+(9*k)," DigitalRoot : ", DigitalRoot,"\n");
}
Comment(List);

I'm looking forward to any suggestions. Thanks.
mladen wrote:
Thu Dec 31, 2020 6:12 pm
Tag
This is an interesting question so just tagging Mladen on this. He's a bit of a maths genuis when it comes to the complex stuff :)

Following.
Download over 500+ Forex & Trading books from Forex-Station's Trader's Library.


Re: Coding Help - Finding Digital Root Source Numbers with MathMod

#1202
ChuChu Rocket wrote:
Tue Jan 05, 2021 1:33 pm

This is an interesting question so just tagging Mladen on this. He's a bit of a maths genuis when it comes to the complex stuff :)

Following.

Thanks ChuChu,

By the way, Nikola Tesla said that, "If you only knew the magnificence of the 3, 6 and 9, then you would have a key to the universe." So I'm experimenting to see how the market reacts to level prices with digital roots of 3, 6 or 9 and to the variations of those 3, 6 and 9 digital roots since level prices with the same digital roots are different if they come from different previous two-digit source numbers. It all seems a bit mystical but there seems to be some truth in it that I feel can benefit traders. Also, if you add the digital roots of the high and low prices of the previous ZigZag leg then the resultant number gives an indication of what price levels the price is most likely to bounce on. With that in mind, the high/low price digital root combinations make all digital root numbers from 1 to 9 significant in forecasting price reversals but I'm still trying to figure out exactly how that works. By observing the relationship between the previous ZigZag leg's high/low price digital root combination and the digital roots of the price levels that the price reverses on, over time a relationship formula should become clear. Maybe some brilliant minds here may have some more clues to the answers.

Re: Coding Help

#1203
mrtools wrote:
Tue Jan 05, 2021 7:44 am
milad1987 wrote:
Tue Dec 29, 2020 6:47 am
hello mrtools and everyone...
is there any way to fix this ERROR in my terminal MT5.... i coding one dynamic indicator for MT5 but now i have this ERROR : about dynamiczone.dll


2020.12.27 01:20:07.548 dz 'C:\Users\Milad\AppData\Roaming\MetaQuotes\Terminal\D0E8209F77C8CF37AD8BF550E51FF075\MQL5\Libraries\dynamicZone.dll' is not 64-bit version




2020.12.27 01:20:09.978 dz (EURUSD,M1) Cannot load 'C:\Users\Milad\AppData\Roaming\MetaQuotes\Terminal\D0E8209F77C8CF37AD8BF550E51FF075\MQL5\Libraries\dynamicZone.dll' [193]
Try this dll file in your libraries folder.
Mrtools thank you!

Re: Coding Help

#1204
mrtools wrote:
Tue Jan 05, 2021 8:01 am
traderduke wrote:
Tue Jan 05, 2021 5:33 am
MrTools
I can’t seem to get the maxbars to work on the XU-semafor but I did get it to work on the chaos semafor, can you help me out?
The XU eats up a lot of cpu.
Thank you again
Ray

XU-SEMAFOR-orig.mq4

Chaos Semafor - 3.4_Mod-3lv-mxb.mq4
Try.
mrtools
Thanks a lot, it works great

Ray

Re: Coding Help

#1205
Hi

I have a script from back in 2015, now it is not working and I can see some errors while compiling, but have no idea how to fix them.

if anyone would help me id be greatful.

Thanks

Code: Select all

#property  copyright "Copyright © 2011, sangmane."
#property  link      "sangmane@forexfactory.com" 
  
#import "EasyOrder.dll"
   int EasyOrder(int hwnd);

string obj;
int i, ticket;
   
int start()
{	
	int hwnd = WindowHandle(Symbol(),0);
	if(hwnd==0) {
		Alert("Error!");
		return;
	}
	int ret = EasyOrder(hwnd);
	Print("Return value: ",ret);	
	if(ret<0) {
		Alert("Dll function failed!");
		return;
	}	
	if(ret==1) ModifyOrder();
	else {
		for(i=ObjectsTotal()-1; i>=0; i--) {
			obj = ObjectName(i);
			if(StringFind(obj,"EASYORDER",0)>=0) ObjectDelete(obj);
		}	
	}
	InitLines();
	return (0);
}
//+------------------------------------------------------------------+

void InitLines()
{
	//Delete old lines
	bool delete;
	int pos;
	int ticket;
	for(i=ObjectsTotal()-1; i>=0; i--) {
		obj = ObjectName(i);
		if(StringFind(obj,"EASYORDER_MOD")>=0) {
			delete = True;
			pos = StringFind(obj,"#",1);
			if(pos<0) continue;
			ticket = StrToDouble(StringSubstr(obj,pos+1,StringLen(obj)-pos-1));
			if(OrderSelect(ticket,SELECT_BY_TICKET)) {
				if(OrderCloseTime()==0) delete = false;
			}
			if(delete) ObjectDelete(obj);
		}
	}
	double sl, tp;
	for(i=0; i<OrdersTotal(); i++) {
		OrderSelect(i,SELECT_BY_POS);
		if(OrderSymbol()==Symbol()) {
			ticket = OrderTicket();			
			obj = "EASYORDER_MOD_SL_#"+ticket;
			sl = OrderStopLoss();
			tp = OrderTakeProfit();
			if(sl==0) sl = OrderOpenPrice();
			if(tp==0) tp = OrderOpenPrice();
			if(ObjectFind(obj)>=0)	ObjectMove(obj,0,Time[0],sl);
			else DrawLine("SL",ticket,sl);
			obj = "EASYORDER_MOD_TP_#"+ticket;
			if(ObjectFind(obj)>=0)	ObjectMove(obj,0,Time[0],tp);
			else DrawLine("TP",ticket,tp);
			if(OrderType()>OP_SELL) {
				obj = "EASYORDER_MOD_PRICE_#"+ticket;
				if(ObjectFind(obj)>=0)	ObjectMove(obj,0,Time[0],OrderOpenPrice());
				else DrawLine("PRICE",ticket,OrderOpenPrice());				
			}
		}
	}
}

void ModifyOrder()
{
	string obj;
	int i, ticket;
	double sl, price, tp;
	double osl, otp;
	for(i=0; i<OrdersTotal(); i++) {
		OrderSelect(i,SELECT_BY_POS);
		if(OrderSymbol()==Symbol()) {
			ticket = OrderTicket();
			sl = 0; price = 0; tp = 0;
			obj = "EASYORDER_MOD_SL_#"+ticket;
			osl = OrderStopLoss();			
			if(osl==0) osl = OrderOpenPrice();
			otp = OrderStopLoss();
			if(otp==0) otp = OrderOpenPrice();			
			if(ObjectFind(obj)>=0)	{
				if(MathAbs(ObjectGet(obj,OBJPROP_PRICE1)-osl)>Point) sl = ObjectGet(obj,OBJPROP_PRICE1);
			}
			
			obj = "EASYORDER_MOD_TP_#"+ticket;
			if(ObjectFind(obj)>=0)	{
				if(MathAbs(ObjectGet(obj,OBJPROP_PRICE1)-otp)>Point) tp = ObjectGet(obj,OBJPROP_PRICE1);
			}
						
			if(OrderType()>OP_SELL) {
				obj = "EASYORDER_MOD_PRICE_#"+ticket;
				if(ObjectFind(obj)>=0)	{
					if(MathAbs(ObjectGet(obj,OBJPROP_PRICE1)-OrderOpenPrice())>Point) price = ObjectGet(obj,OBJPROP_PRICE1);
				}
			}
			
			if(sl+tp+price>0) {
				if(sl==0) sl = OrderStopLoss();
				if(tp==0) tp = OrderTakeProfit();
				if(price==0) price = OrderOpenPrice();
				OrderModify(ticket,price,sl,tp,0,CLR_NONE);
			}
		}
	}
}

void DrawLine(string type, int ticket, double level)
{
	string obj = "EASYORDER_MOD_"+type+"_#"+ticket;
	color clr = Red;
	if(type=="PRICE") clr = LimeGreen;
	//else if(type=="TP") clr = Blue;
	ObjectCreate(obj,OBJ_HLINE,0,Time[0],level,0,0);
	ObjectSet(obj,OBJPROP_COLOR,clr);
	ObjectSet(obj,OBJPROP_STYLE,STYLE_DASHDOT);
}
EasyOrder.mq4
(3.39 KiB) Downloaded 24 times


Re: Coding Help

#1206
Hello Mr.Tools and other coders. Happy and prosperous new year to you all and all traders in the house. Please i have this indicator that does not update its signal unless i click on indicator list, and bring it out, click ok, before the arrows can show up, i believe there could be some errors that is not allowing auto update, for the arrows to pop up at the appropriate time. Kindly help me to check the indicator and correct whatever error that is hindering the arrows to come up on chart on all time frame. Thanking you in advance for your precious time.
#Momentum onChartSignals Indicator v1.0.mq4
(6.92 KiB) Downloaded 31 times

Re: Coding Help

#1207
Maffe wrote:
Tue Jan 12, 2021 4:31 am
Hi

I have a script from back in 2015, now it is not working and I can see some errors while compiling, but have no idea how to fix them.

if anyone would help me id be greatful.

Thanks

Code: Select all

#property  copyright "Copyright © 2011, sangmane."
#property  link      "sangmane@forexfactory.com" 
  
#import "EasyOrder.dll"
   int EasyOrder(int hwnd);

string obj;
int i, ticket;
   
int start()
{	
	int hwnd = WindowHandle(Symbol(),0);
	if(hwnd==0) {
		Alert("Error!");
		return;
	}
	int ret = EasyOrder(hwnd);
	Print("Return value: ",ret);	
	if(ret<0) {
		Alert("Dll function failed!");
		return;
	}	
	if(ret==1) ModifyOrder();
	else {
		for(i=ObjectsTotal()-1; i>=0; i--) {
			obj = ObjectName(i);
			if(StringFind(obj,"EASYORDER",0)>=0) ObjectDelete(obj);
		}	
	}
	InitLines();
	return (0);
}
//+------------------------------------------------------------------+

void InitLines()
{
	//Delete old lines
	bool delete;
	int pos;
	int ticket;
	for(i=ObjectsTotal()-1; i>=0; i--) {
		obj = ObjectName(i);
		if(StringFind(obj,"EASYORDER_MOD")>=0) {
			delete = True;
			pos = StringFind(obj,"#",1);
			if(pos<0) continue;
			ticket = StrToDouble(StringSubstr(obj,pos+1,StringLen(obj)-pos-1));
			if(OrderSelect(ticket,SELECT_BY_TICKET)) {
				if(OrderCloseTime()==0) delete = false;
			}
			if(delete) ObjectDelete(obj);
		}
	}
	double sl, tp;
	for(i=0; i<OrdersTotal(); i++) {
		OrderSelect(i,SELECT_BY_POS);
		if(OrderSymbol()==Symbol()) {
			ticket = OrderTicket();			
			obj = "EASYORDER_MOD_SL_#"+ticket;
			sl = OrderStopLoss();
			tp = OrderTakeProfit();
			if(sl==0) sl = OrderOpenPrice();
			if(tp==0) tp = OrderOpenPrice();
			if(ObjectFind(obj)>=0)	ObjectMove(obj,0,Time[0],sl);
			else DrawLine("SL",ticket,sl);
			obj = "EASYORDER_MOD_TP_#"+ticket;
			if(ObjectFind(obj)>=0)	ObjectMove(obj,0,Time[0],tp);
			else DrawLine("TP",ticket,tp);
			if(OrderType()>OP_SELL) {
				obj = "EASYORDER_MOD_PRICE_#"+ticket;
				if(ObjectFind(obj)>=0)	ObjectMove(obj,0,Time[0],OrderOpenPrice());
				else DrawLine("PRICE",ticket,OrderOpenPrice());				
			}
		}
	}
}

void ModifyOrder()
{
	string obj;
	int i, ticket;
	double sl, price, tp;
	double osl, otp;
	for(i=0; i<OrdersTotal(); i++) {
		OrderSelect(i,SELECT_BY_POS);
		if(OrderSymbol()==Symbol()) {
			ticket = OrderTicket();
			sl = 0; price = 0; tp = 0;
			obj = "EASYORDER_MOD_SL_#"+ticket;
			osl = OrderStopLoss();			
			if(osl==0) osl = OrderOpenPrice();
			otp = OrderStopLoss();
			if(otp==0) otp = OrderOpenPrice();			
			if(ObjectFind(obj)>=0)	{
				if(MathAbs(ObjectGet(obj,OBJPROP_PRICE1)-osl)>Point) sl = ObjectGet(obj,OBJPROP_PRICE1);
			}
			
			obj = "EASYORDER_MOD_TP_#"+ticket;
			if(ObjectFind(obj)>=0)	{
				if(MathAbs(ObjectGet(obj,OBJPROP_PRICE1)-otp)>Point) tp = ObjectGet(obj,OBJPROP_PRICE1);
			}
						
			if(OrderType()>OP_SELL) {
				obj = "EASYORDER_MOD_PRICE_#"+ticket;
				if(ObjectFind(obj)>=0)	{
					if(MathAbs(ObjectGet(obj,OBJPROP_PRICE1)-OrderOpenPrice())>Point) price = ObjectGet(obj,OBJPROP_PRICE1);
				}
			}
			
			if(sl+tp+price>0) {
				if(sl==0) sl = OrderStopLoss();
				if(tp==0) tp = OrderTakeProfit();
				if(price==0) price = OrderOpenPrice();
				OrderModify(ticket,price,sl,tp,0,CLR_NONE);
			}
		}
	}
}

void DrawLine(string type, int ticket, double level)
{
	string obj = "EASYORDER_MOD_"+type+"_#"+ticket;
	color clr = Red;
	if(type=="PRICE") clr = LimeGreen;
	//else if(type=="TP") clr = Blue;
	ObjectCreate(obj,OBJ_HLINE,0,Time[0],level,0,0);
	ObjectSet(obj,OBJPROP_COLOR,clr);
	ObjectSet(obj,OBJPROP_STYLE,STYLE_DASHDOT);
}
Removed all the errors but not sure i did you any good.

Re: Coding Help

#1208
Modahen77 wrote:
Thu Jan 14, 2021 6:48 am
Hello Mr.Tools and other coders. Happy and prosperous new year to you all and all traders in the house. Please i have this indicator that does not update its signal unless i click on indicator list, and bring it out, click ok, before the arrows can show up, i believe there could be some errors that is not allowing auto update, for the arrows to pop up at the appropriate time. Kindly help me to check the indicator and correct whatever error that is hindering the arrows to come up on chart on all time frame. Thanking you in advance for your precious time.
Looks to me it repaints and possibly need a complete recoding to make it work correctly.

Re: Coding Help

#1209
mrtools wrote:
Thu Jan 14, 2021 2:56 pm
Maffe wrote:
Tue Jan 12, 2021 4:31 am
Hi

I have a script from back in 2015, now it is not working and I can see some errors while compiling, but have no idea how to fix them.

if anyone would help me id be greatful.

Thanks

Code: Select all

#property  copyright "Copyright © 2011, sangmane."
#property  link      "sangmane@forexfactory.com" 
  
#import "EasyOrder.dll"
   int EasyOrder(int hwnd);

string obj;
int i, ticket;
   
int start()
{	
	int hwnd = WindowHandle(Symbol(),0);
	if(hwnd==0) {
		Alert("Error!");
		return;
	}
	int ret = EasyOrder(hwnd);
	Print("Return value: ",ret);	
	if(ret<0) {
		Alert("Dll function failed!");
		return;
	}	
	if(ret==1) ModifyOrder();
	else {
		for(i=ObjectsTotal()-1; i>=0; i--) {
			obj = ObjectName(i);
			if(StringFind(obj,"EASYORDER",0)>=0) ObjectDelete(obj);
		}	
	}
	InitLines();
	return (0);
}
//+------------------------------------------------------------------+

void InitLines()
{
	//Delete old lines
	bool delete;
	int pos;
	int ticket;
	for(i=ObjectsTotal()-1; i>=0; i--) {
		obj = ObjectName(i);
		if(StringFind(obj,"EASYORDER_MOD")>=0) {
			delete = True;
			pos = StringFind(obj,"#",1);
			if(pos<0) continue;
			ticket = StrToDouble(StringSubstr(obj,pos+1,StringLen(obj)-pos-1));
			if(OrderSelect(ticket,SELECT_BY_TICKET)) {
				if(OrderCloseTime()==0) delete = false;
			}
			if(delete) ObjectDelete(obj);
		}
	}
	double sl, tp;
	for(i=0; i<OrdersTotal(); i++) {
		OrderSelect(i,SELECT_BY_POS);
		if(OrderSymbol()==Symbol()) {
			ticket = OrderTicket();			
			obj = "EASYORDER_MOD_SL_#"+ticket;
			sl = OrderStopLoss();
			tp = OrderTakeProfit();
			if(sl==0) sl = OrderOpenPrice();
			if(tp==0) tp = OrderOpenPrice();
			if(ObjectFind(obj)>=0)	ObjectMove(obj,0,Time[0],sl);
			else DrawLine("SL",ticket,sl);
			obj = "EASYORDER_MOD_TP_#"+ticket;
			if(ObjectFind(obj)>=0)	ObjectMove(obj,0,Time[0],tp);
			else DrawLine("TP",ticket,tp);
			if(OrderType()>OP_SELL) {
				obj = "EASYORDER_MOD_PRICE_#"+ticket;
				if(ObjectFind(obj)>=0)	ObjectMove(obj,0,Time[0],OrderOpenPrice());
				else DrawLine("PRICE",ticket,OrderOpenPrice());				
			}
		}
	}
}

void ModifyOrder()
{
	string obj;
	int i, ticket;
	double sl, price, tp;
	double osl, otp;
	for(i=0; i<OrdersTotal(); i++) {
		OrderSelect(i,SELECT_BY_POS);
		if(OrderSymbol()==Symbol()) {
			ticket = OrderTicket();
			sl = 0; price = 0; tp = 0;
			obj = "EASYORDER_MOD_SL_#"+ticket;
			osl = OrderStopLoss();			
			if(osl==0) osl = OrderOpenPrice();
			otp = OrderStopLoss();
			if(otp==0) otp = OrderOpenPrice();			
			if(ObjectFind(obj)>=0)	{
				if(MathAbs(ObjectGet(obj,OBJPROP_PRICE1)-osl)>Point) sl = ObjectGet(obj,OBJPROP_PRICE1);
			}
			
			obj = "EASYORDER_MOD_TP_#"+ticket;
			if(ObjectFind(obj)>=0)	{
				if(MathAbs(ObjectGet(obj,OBJPROP_PRICE1)-otp)>Point) tp = ObjectGet(obj,OBJPROP_PRICE1);
			}
						
			if(OrderType()>OP_SELL) {
				obj = "EASYORDER_MOD_PRICE_#"+ticket;
				if(ObjectFind(obj)>=0)	{
					if(MathAbs(ObjectGet(obj,OBJPROP_PRICE1)-OrderOpenPrice())>Point) price = ObjectGet(obj,OBJPROP_PRICE1);
				}
			}
			
			if(sl+tp+price>0) {
				if(sl==0) sl = OrderStopLoss();
				if(tp==0) tp = OrderTakeProfit();
				if(price==0) price = OrderOpenPrice();
				OrderModify(ticket,price,sl,tp,0,CLR_NONE);
			}
		}
	}
}

void DrawLine(string type, int ticket, double level)
{
	string obj = "EASYORDER_MOD_"+type+"_#"+ticket;
	color clr = Red;
	if(type=="PRICE") clr = LimeGreen;
	//else if(type=="TP") clr = Blue;
	ObjectCreate(obj,OBJ_HLINE,0,Time[0],level,0,0);
	ObjectSet(obj,OBJPROP_COLOR,clr);
	ObjectSet(obj,OBJPROP_STYLE,STYLE_DASHDOT);
}
Removed all the errors but not sure i did you any good.
Thank you a million times :)

Re: Coding Help

#1210
Maffe wrote:
Thu Jan 14, 2021 8:42 pm
mrtools wrote:
Thu Jan 14, 2021 2:56 pm


Removed all the errors but not sure i did you any good.
Thank you a million times :)
Hi Mr.Tools

Still seems to get 6 errores, did you paste the new code?


  1. Similar Topics

    1. Coding help please

      1 Replies 248 Views

      by Deez, Thu Nov 05, 2020 6:54 pm in Coding Help

      1 Replies
      248 Views
    2. Coding help

      0 Replies 410 Views

      by Mukhari325, Mon Jul 20, 2020 8:54 pm in Coding Help

      0 Replies
      410 Views

Return to “Coding Help”