expert advisor - miscellaneous questions - page 18

 

Marco vd Heijden:

Well if you really want to wait for each tick you will have to write a separate EA for every symbol and use the OnTick() function.
But i can tell you i also program micro controllers and they are in an endless while loop (forever) until a power failure, or interrupt occurs.
To check if a condition is true or false, uses the smallest Boolean data type and your processor already does that millions if not billions of times per second with all the processes running in the background and the graphics etc.
It's when you start doing heavy calculations involving larger data types, that this becomes an issue.

#Orders Calculations & Account Info's Updates - Closed 

Thanks for the comment.

Separate EA, oh! I really do not like playing multiple EA's.
Maybe I will use continuously loops even sometimes loops for nothing.

// I hope one of below them will work for me
EventSetMillisecondTimer( 750 );
EventSetTimer( 1 );

I do not think my PC so weak, I hope it can help me.
...heavy calculations... hmm, really I do not know - " Orders Sell, Buy, Profit, All positions " calculations are heavy or what? Is that heavy, please?

So, thanks for your comments.
All the best. 

 

No thats not heavy calculations, and remember that it was designed to handle all positions.

Here is an example of what it easily can do.


So here it is asking for the volumes on all timeframes for all symbols and also the first row which is the spread for all available symbols.

Now it has to sort from min to max on all variables for all symbols so that's a lot of work.



Or this one is a multi symbol Renko Matrix.

The vertical component of stacking bricks is removed it now lay's 40 pip bricks horizontally which makes it suitable to compare all symbols against each other on just one chart.

It would normally be 26 separate Renko charts which would make it VERY hard to compare them all yet with this type it can be done in the blink of an eye.

Of course it has to track movement for 26 symbols which is also a lot of work, but not really for a good and fast computer so i hope you get the point.

It's all done with a fast running timer, i would not even know how to code it on a tick per symbol basis it would be madness if you ask me.

 

Marco vd Heijden:

It's all done with a fast running timer, i would not even know how to code it on a tick per symbol basis it would be madness if you ask me.

Thanks Man for the comment.

I just need to say, If I will go to into it, I know for sure I will leave at the there like a Coder or Programmer. ( because if someone need to do that they could be coder or programmer... )
That will take a long time from me. Just a give up...

I think I could close this subtopic, because I am worrying it will take a long time from me.
Sometimes I lose myself in this Code Industry.
Anyway so far I got a lot of things from that code industry.

After your latest comment and I think if I need to get only Terminal Trade panel symbols ticks, I could try very different ways ( but actually my code knowledge can't give me that opportunity ).
Also I am thinking really I am first man which is thinking about Terminal Trade panel ticks?! ( I would not like to this is so. )

I saw a long time ago some Dashboard EA's - which is I am not really interesting that type of EA's, it is absolutely not useful for me.

Thanks so much for your attempts to help me.

( English is not my native language ) 

 

It takes time, but not forever.

And when you get smarter you will also get faster due to experience.

The beginning is the hardest part.

You can make it as simple or as complicated as you like.

But it can be easier to start with simple things.

But what is your goal do you want to be a good coder? or do you want to be a good trader? or both ?

 

Marco vd Heijden:

It takes time, but not forever.
And when you get smarter you will also get faster due to experience.
The beginning is the hardest part.
You can make it as simple or as complicated as you like.
But it can be easier to start with simple things.
But what is your goal do you want to be a good coder? or do you want to be a good trader? or both ?

Yeah you right, but I have not enough time for it for now, as I said I am worrying about that it will take a lot of time from me.

Yeah right, when I start to write a script for my Trade Panel EA's, I started just simple things, but now I love my Trade Panel EA's. Yeah it took a lot of time from me, but it's worth it.

Actually, today I am not thinking I will be Coder & Programmer. But that does not mean I do not know what are Coder & Programmer.
Sometimes I have idea but I think can't do it, I think it couldn't be possible.
There is only one reason, that is just my poor code knowledge.
Also I can't write down that ideas, but I do not know why?!

Yeah! Today I want to be a good trader then coder.

Thanks for your time.

 

You can put it in a flow chart it's a bit easier.

Here's an example:

You can make them for free at http://draw.io

draw.io - free flowchart maker and diagrams online
draw.io - free flowchart maker and diagrams online
  • draw.io
draw.io (formerly Diagramly) is free online diagram software. You can use it as a flowchart maker, network diagram software, to create UML online, as an ER diagram tool, to design database schema, to build BPMN online, as a circuit diagram maker, and more. draw.io can import .vsdx, Gliffy™ and Lucidchart™ files .
 
Marco vd Heijden:

You can put it in a flow chart it's a bit easier.
Here's an example:
You can make them for free at http://draw.io

Wow, thanks to shared it with me.
I will try it when I can take a time for it.

Thanks a lot man.

 

#Spread Lines - Open

Q:     If I am using few TrendLine objects, should I use ' ObjectMove ' function for each of them?
         Just I am looking for smart methods for them, please give me advice or help me with example.

ObjectMove( name, 0, Time[0], Bid );
ObjectMove( name, 1, Time[0] + ( PeriodSeconds( NULL ) * 1 ), Bid );

        As you know if I am using that TrendLine objects for Spread Lines, that TrendLine objects sizes could changes in different Chart TimeFrames and Scales.
Q:    How can I learn about that with example?

Q:    Also, I need to write that script in my EA's Trade Panel, what is your advice, please?

Thanks in advance.

 

Do you mean a vertical line moving on price level, a horizontal lime moving ocross the time axis, or a trendline by angle which moves along both?

You can either move them by ObjectMove() or delete them and draw new ones.

If it's timeframe dependent you can use the time frame switch posted a few pages back.

I always delete everything upon switching to a different time frame on OnDeinit() and then draw new ones in OnInit() or a separate draw function().

If you want just spread lines those are the same on any time timeframe so you can just create two or three in oninit() and move them in OnTick().

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
          
   ObjectCreate("Ask",OBJ_HLINE,0,0,Ask);ObjectSetInteger(0,"Ask",OBJPROP_COLOR,clrGold);ObjectSetInteger(0,"Ask",OBJPROP_WIDTH,1);
   ObjectCreate("Bid",OBJ_HLINE,0,0,Bid);ObjectSetInteger(0,"Bid",OBJPROP_COLOR,clrGold);ObjectSetInteger(0,"Bid",OBJPROP_WIDTH,1);
   ObjectCreate("Center",OBJ_HLINE,0,0,(Ask+Bid)/2);

   ObjectSetInteger(0,"Ask",OBJPROP_SELECTABLE,false);
   ObjectSetInteger(0,"Bid",OBJPROP_SELECTABLE,false);
   ObjectSetInteger(0,"Center",OBJPROP_SELECTABLE,false);

   ObjectSetInteger(0,"Ask",OBJPROP_BACK,true);
   ObjectSetInteger(0,"Bid",OBJPROP_BACK,true);
   ObjectSetInteger(0,"Center",OBJPROP_BACK,true);

   ObjectSetInteger(0,"Center",OBJPROP_COLOR,clrDeepSkyBlue);
   ObjectSetInteger(0,"Center",OBJPROP_WIDTH,1);
   ObjectSetInteger(0,"Center",OBJPROP_STYLE,STYLE_DASH);

//---

   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+


//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
   ObjectMove("Ask",0,0,Ask);
   ObjectMove("Bid",0,0,Bid);
   ObjectMove("Center",0,0,(Ask+Bid)/2);
  }
//+------------------------------------------------------------------+


Quite simple or did you have anything else in mind ?

 

Marco vd Heijden:

Quite simple or did you have anything else in mind ?

#Spread Lines - Closed 

Thanks for your great comment which is helping me a lot.

No, I do not need to use Vertical Line and Horizontal line just for this function. ( But I will use Horizontal Line for OrderOpenPrice() line )

Which one I need to use TrendLine objects for like a Spread Prices line - Bid & Ask Lines.
( When my code knowledge under zero - I had have idea about Spread Lines design - but I thought it isn't possible till I saw one indicator which is changed Spread lines - and I inspired and so I already started trying to do it for myself - even that indicator is free - I do not like to use EA's and Indicator's which one them made by others people - without " News Indicator " )

N ( you Noted ): If it's timeframe dependent you can use the time frame switch posted a few pages back.
N:                     I always delete everything upon switching to a different time frame on OnDeinit() and then draw new ones in OnInit() or a separate draw function().

        Oh! Absolutely I will try this.
        I'd like to note:
        As I mentioned I did a lot of things so far for my indicators and ea's really all of them works perfectly for me, but if you ask how did you done them?
        Oh! Man I can't remember how I done all of that so, just I want to say, I will check few pages back...

        And I would like to study how can I draw new ones..., because so far I see one problem when I switch time frame TrendLine not moves correctly.

--- 

        I am trying below code for Spread Lines - Bid & Ask Lines.
Q:    Which one you mentioned about that posted, is that post can solve my below code issue, please? ( I do not tried it yet. )
Q:    Also is it possible can you let me what is wrong at the below code?

S:     ( I solved that issues. )

Thanks in advance.