Awesome - original version

The place for Peaky and Peaky-related stuff.
Post Reply
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Awesome - original version

Post by SteveHopwood »

V 1i is in post 1. I replaced a couple of my more ridiculous indexes with multi-field arrays - something only the coders will see.

More to the point for you guys is the code that Thomas sent me today to tidy up the chart display. Those annoying gaps and places where text is overwritten are all gone. Brilliant. :clap: :clap: :clap: :clap: :clap: :clap: :clap: :clap: :clap: :clap:

You can add the code to any existing EA created from my shells since lifesys sent me the original code. Go to void Display(string text) and copy this over the top of the existing function:

Code: Select all

void Display(string text)
{
  string lab_str = "OAM-" + IntegerToString(DisplayCount);  
  double ofset = 0;
  string textpart[5];
  uint w,h;
  
  for (int cc = 0; cc < 5; cc++)
  {
     textpart[cc] = StringSubstr(text,cc*63,64);
     if (StringLen(textpart[cc]) ==0) continue;
     lab_str = lab_str + IntegerToString(cc);
    
     ObjectCreate(lab_str, OBJ_LABEL, 0, 0, 0);
     ObjectSet(lab_str, OBJPROP_CORNER, 0);
     ObjectSet(lab_str, OBJPROP_XDISTANCE, DisplayX + ofset);
     ObjectSet(lab_str, OBJPROP_YDISTANCE, DisplayY+DisplayCount*(fontSise+4));
     ObjectSet(lab_str, OBJPROP_BACK, false);
     ObjectSetText(lab_str, textpart[cc], fontSise, fontName, colour);
    
     /////////////////////////////////////////////////
     //Calculate label size
     //Tomele supplied this code to eliminate the gaps in the text.
     //Thanks Thomas.
     TextSetFont(fontName,-fontSise*10,0,0);
     TextGetSize(textpart[cc],w,h);
    
     //Trim trailing space
     if (StringSubstr(textpart[cc],63,1)==" ")
        ofset+=(int)(w-fontSise*0.25);
     else
        ofset+=(int)(w-fontSise*0.65);
     /////////////////////////////////////////////////
        
  }//for (int cc = 0; cc < 5; cc++)
}
You can also delete this line of code:
extern double spacingtweek = 0.6; // adjustment to reform lines for different font size
as it is no longer used. Ditto the function string FormatNumber(double x, int width, int precision).

You will find you can have text as large as you can reasonably want it without distorting the display.

Thanks Thomas. You have done as all a huge favour. :clap: :clap: :clap: :clap: :clap: :clap: :clap:

:xm:
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
User avatar
TraderJoeForex
Trader
Posts: 1157
Joined: Fri Mar 08, 2013 10:29 pm
Location: South London

Awesome - original version

Post by TraderJoeForex »

Thanks Steve and Thomas :smile:
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Awesome - original version

Post by SteveHopwood »

Here is another PM I just received from Thomas:
tomele wrote:Hi Steve.

Oh my god, those skinners really think in pixels ...

I made some minor optimizations for larger font sizes in the "void Display()" code. Mainly the line distances are calculated better (line 17). If you think the line spacing ist too wide, you can use a factor of 1.4 or less here. The parameters in line 30+32 are perfect for larger font sizes and even other fonts now. If you want to, just replace the code in your post with this one:

Code: Select all

void Display(string text)
{
  string lab_str = "OAM-" + IntegerToString(DisplayCount);  
  double ofset = 0;
  string textpart[5];
  uint w,h;
  
  for (int cc = 0; cc < 5; cc++)
  {
     textpart[cc] = StringSubstr(text,cc*63,64);
     if (StringLen(textpart[cc]) ==0) continue;
     lab_str = lab_str + IntegerToString(cc);
    
     ObjectCreate(lab_str, OBJ_LABEL, 0, 0, 0);
     ObjectSet(lab_str, OBJPROP_CORNER, 0);
     ObjectSet(lab_str, OBJPROP_XDISTANCE, DisplayX + ofset);
     ObjectSet(lab_str, OBJPROP_YDISTANCE, DisplayY+DisplayCount*(int)(fontSise*1.5));
     ObjectSet(lab_str, OBJPROP_BACK, false);
     ObjectSetText(lab_str, textpart[cc], fontSise, fontName, colour);
    
     /////////////////////////////////////////////////
     //Calculate label size
     //Tomele supplied this code to eliminate the gaps in the text.
     //Thanks Thomas.
     TextSetFont(fontName,-fontSise*10,0,0);
     TextGetSize(textpart[cc],w,h);
    
     //Trim trailing space
     if (StringSubstr(textpart[cc],63,1)==" ")
        ofset+=(int)(w-fontSise*0.3);
     else
        ofset+=(int)(w-fontSise*0.7);
     /////////////////////////////////////////////////
        
  }//for (int cc = 0; cc < 5; cc++)
}
Nice, isnt it?



Cheers, Thomas
I have not made the extra changes to Awesome, so copy the code here over the existing function if you want the latest improvements.

Thanks Thomas. :clap: :clap: :clap: :clap: :clap: :clap: :clap: :clap:

:xm:
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
DigitalCrypto
Trader
Posts: 237
Joined: Tue Feb 24, 2015 4:38 am

Awesome - original version

Post by DigitalCrypto »

Brilliant gentlemen. Huge Thank you! :D
DigitalCrypto
Trader
Posts: 237
Joined: Tue Feb 24, 2015 4:38 am

Awesome - original version

Post by DigitalCrypto »

Hey Steve,

I would like to add "Todays P&L" to the left of "Daily Profit Target" on the screen display.

I see around line 1577 of CountOpenTrades() the "EntirePositionCashUpl" var. Would this be the similar in function to your shell's "OverallProfit" variable?

Thanks,
David

EDIT: This is the change I made

Code: Select all

   //Profit targets
   text = "";
   
   if (!CloseEnough(EntirePositionCashUpl, 0) )
      text = "Today's P&L = " + DoubleToStr(EntirePositionCashUpl, 2) + "    ";

   if (!CloseEnough(DailyProfitTarget, 0) )
      text = text + "Daily profit target = " + DoubleToStr(DailyProfitTarget, 2) + "    ";
   if (!CloseEnough(WeeklyProfitTarget, 0) )
      text = text + "Weekly profit target = " + DoubleToStr(WeeklyProfitTarget, 2);
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Awesome - original version

Post by SteveHopwood »

DigitalCrypto » Mon Sep 11, 2017 12:02 am wrote:Hey Steve,

I would like to add "Todays P&L" to the left of "Daily Profit Target" on the screen display.

I see around line 1577 of CountOpenTrades() the "EntirePositionCashUpl" var. Would this be the similar in function to your shell's "OverallProfit" variable?

Thanks,
David

EDIT: This is the change I made
No, it isn't but this is a good idea so I have added it to V 1j in post 1 - also Thomas' improvement to his improvements to the chart display code.

Yours called for a new variable, so do a search for "ProfitToday" to follow the code I added.

:xm:
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
DigitalCrypto
Trader
Posts: 237
Joined: Tue Feb 24, 2015 4:38 am

Awesome - original version

Post by DigitalCrypto »

Many thanks Steve,

I was a bit lost on how to go about that. I did have to make a small change in 1j in the DisplayUserFeedback to get the text variable to append.

Code: Select all

text = "Daily profit target = " + DoubleToStr(DailyProfitTarget, 2) + "    ";
Changed to

Code: Select all

text = text + "Daily profit target = " + DoubleToStr(DailyProfitTarget, 2) + "    ";
Works perfectly! :clap:
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Awesome - original version

Post by SteveHopwood »

DigitalCrypto » Mon Sep 11, 2017 11:33 am wrote:Many thanks Steve,

I was a bit lost on how to go about that. I did have to make a small change in 1j in the DisplayUserFeedback to get the text variable to append.

Code: Select all

text = "Daily profit target = " + DoubleToStr(DailyProfitTarget, 2) + "    ";
Changed to

Code: Select all

text = text + "Daily profit target = " + DoubleToStr(DailyProfitTarget, 2) + "    ";
Works perfectly! :clap:
I forgot to add that bit. I have added it to 1j in post 1.

:xm:
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
User avatar
SteveHopwood
Owner
Posts: 9904
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Awesome - original version

Post by SteveHopwood »

V 1k is in post 1, courtesy of Thomas again. Just look at what he has done with the chart display:
XAUUSDH4.png
Brilliant Thomas. Absolutely brilliant. :clap: :clap: :clap: :clap: :clap: :clap: :clap: :clap: :clap: :clap: :clap: :clap: :clap: :clap: :clap: :clap: :clap: :clap: :clap:

:xm:
You do not have the required permissions to view the files attached to this post.
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. pianodoodler@hotmail.com is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
DigitalCrypto
Trader
Posts: 237
Joined: Tue Feb 24, 2015 4:38 am

Awesome - original version

Post by DigitalCrypto »

Damn fine job there Steve and Tomele

Now that you've gone and made a display that "purty" it begs for a feature request for even better. I don't suppose you could make the symbol name clickable to open that particular chart could you?

I recall seeing "Dashboard Trading" thread on that other site that had some source code you could probably get some ideas from.
Post Reply

Return to “Peaky forum”