My shell EA code

Post Reply
User avatar
gaheitman
Trader
Posts: 655
Joined: Tue Nov 15, 2011 10:55 pm
Location: Richmond, VA, US

Boxes!

Post by gaheitman »

I thought this was way cool too, and while I'm waiting for the US Session to roll around I decided to play with your idea a bit.

I changed the font to 300 for both of them. I use a white background with my charts, so I changed the color of the first one to white and the second to dark grey. I then offset the first one to line up with the beginning of the comment display and the second to be slightly offset from the first. The final effect is what looks like a floating window with a shadow. I know, I know, time well spent. :lol:

The code:

Code: Select all

   ObjectCreate("LabelBox1", OBJ_LABEL, 0, 0, 0); ObjectSetText("LabelBox1","g",300,"Webdings",DarkGray); ObjectSet("LabelBox1", OBJPROP_XDISTANCE, 90); ObjectSet("LabelBox1", OBJPROP_YDISTANCE, 25); ObjectSet("LabelBox1",OBJPROP_BACK,0);
   ObjectCreate("LabelBox2", OBJ_LABEL, 0, 0, 0); ObjectSetText("LabelBox2","g",300,"Webdings",White); ObjectSet("LabelBox2", OBJPROP_XDISTANCE, 86); ObjectSet("LabelBox2", OBJPROP_YDISTANCE, 21); ObjectSet("LabelBox2",OBJPROP_BACK,0);
The pretty picture:
pic_04 2011-11-30 05.42.gif
Enjoy! ;>
youcrazykids wrote:Hi all

Although nothing startling, I've found a way of displaying comments and screen messages, without them being obscured by bars on the chart.

To do this, in the init() function, I add two text labels to the chart, at coordinates 0,0. The Webdings character set contains a solid block, which you can scale up to 150pts, to create a "box". So, a couple of these stacked vertically, then coloured black, does the trick. The comment text sits atop these, and they both stay fixed relative to the window, not the scrolling chart.

Here's the code, and a screenshot. Feel free to adopt/adapt/ridicule it as you wish ;)

Code: Select all

ObjectCreate("LabelBox1", OBJ_LABEL, 0, 0, 0); ObjectSetText("LabelBox1","g",150,"Webdings",Black); ObjectSet("LabelBox1", OBJPROP_XDISTANCE, 0); ObjectSet("LabelBox1", OBJPROP_YDISTANCE, 13); ObjectSet("LabelBox1",OBJPROP_BACK,0);
ObjectCreate("LabelBox2", OBJ_LABEL, 0, 0, 0); ObjectSetText("LabelBox2","g",150,"Webdings",Black); ObjectSet("LabelBox2", OBJPROP_XDISTANCE, 0); ObjectSet("LabelBox2", OBJPROP_YDISTANCE, 213); ObjectSet("LabelBox2",OBJPROP_BACK,0);
Comment("","\ntext text text text text text text text text text");
Example.JPG
Cheers

youcrazykids[/size]
You do not have the required permissions to view the files attached to this post.
magft
Trader
Posts: 195
Joined: Tue Nov 15, 2011 9:59 pm
Location: East Midlands, UK

Re: Boxes!

Post by magft »

gaheitman wrote:I thought this was way cool too, and while I'm waiting for the US Session to roll around I decided to play with your idea a bit.

I changed the font to 300 for both of them. I use a white background with my charts, so I changed the color of the first one to white and the second to dark grey. I then offset the first one to line up with the beginning of the comment display and the second to be slightly offset from the first. The final effect is what looks like a floating window with a shadow. I know, I know, time well spent. :lol:

The code:

Code: Select all

   ObjectCreate("LabelBox1", OBJ_LABEL, 0, 0, 0); ObjectSetText("LabelBox1","g",300,"Webdings",DarkGray); ObjectSet("LabelBox1", OBJPROP_XDISTANCE, 90); ObjectSet("LabelBox1", OBJPROP_YDISTANCE, 25); ObjectSet("LabelBox1",OBJPROP_BACK,0);
   ObjectCreate("LabelBox2", OBJ_LABEL, 0, 0, 0); ObjectSetText("LabelBox2","g",300,"Webdings",White); ObjectSet("LabelBox2", OBJPROP_XDISTANCE, 86); ObjectSet("LabelBox2", OBJPROP_YDISTANCE, 21); ObjectSet("LabelBox2",OBJPROP_BACK,0);
The pretty picture:
pic_04 2011-11-30 05.42.gif
Enjoy! ;>
That is very nice, I think this is a good idea as it makes it easy to see comments. I will look into this :lol:
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.

Re: My shell EA code

Post by SteveHopwood »

Latest update in post 1.

For those of a delicate disposition, here is the sanitised rationale:
It appears that the markets can sometimes be moving so quickly that ECN brokers will be unable to allow modifications of trades that update stop losses and take profits. I have added code to CountOpenTrades() that will detect when this happens, and further call functions that will replace the missing tp/sl.


Now, here is what I really mean. Do not read on if bad language offends you.

Only a total tit fails to recognise that some bastard criminals have rabidly adopted ECN in the hope that this will happen:
  • Naive trader sends a trade.
    Platform freezes up before there is time to send the modification of the trade that adds a sl/tp.
    Said platform freeze can be encouraged/simulated by all sorts of thingies that are 'out of control of the broker. Please be assured that we continue to develop our services to the benefit of our valued clients '.
Total shits.

So, these mindless, turd-brained (and I use the term 'brained' with reservation), manipulative fucking bastards are forcing those of us daft enough to play their game to accept that:
  • We can send trades without stops
    The stops we try to send as a second stage, will not be accepted. Ok, so they all offer that bloody silly order form that allow us to input stops, but it seems there is not guarantee that the stop modifications will actually happen
So, the latest mod tells the bot to keep on trying to add stops etc even though the fucking bastard wanking shits have done their best to stop this happening.

I will defeat these bastards.

:D
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.
magft
Trader
Posts: 195
Joined: Tue Nov 15, 2011 9:59 pm
Location: East Midlands, UK

Re: My shell EA code

Post by magft »

SteveHopwood wrote:Latest update in post 1.

For those of a delicate disposition, here is the sanitised rationale:
It appears that the markets can sometimes be moving so quickly that ECN brokers will be unable to allow modifications of trades that update stop losses and take profits. I have added code to CountOpenTrades() that will detect when this happens, and further call functions that will replace the missing tp/sl.


Now, here is what I really mean. Do not read on if bad language offends you.

Only a total tit fails to recognise that some bastard criminals have rabidly adopted ECN in the hope that this will happen:
  • Naive trader sends a trade.
    Platform freezes up before there is time to send the modification of the trade that adds a sl/tp.
    Said platform freeze can be encouraged/simulated by all sorts of thingies that are 'out of control of the broker. Please be assured that we continue to develop our services to the benefit of our valued clients '.
Total shits.

So, these mindless, turd-brained (and I use the term 'brained' with reservation), manipulative fucking bastards are forcing those of us daft enough to play their game to accept that:
  • We can send trades without stops
    The stops we try to send as a second stage, will not be accepted. Ok, so they all offer that bloody silly order form that allow us to input stops, but it seems there is not guarantee that the stop modifications will actually happen
So, the latest mod tells the bot to keep on trying to add stops etc even though the fucking bastard wanking shits have done their best to stop this happening.

I will defeat these bastards.

:D
Nice one Steve.

BTW the time checking script by George had to be modified to work correctly. I think it now works without issues.

Code: Select all

bool CheckTradingTimes(datetime Now)
{
   //Courtesy of George
   datetime MorningBeg, MorningEnd, EveningBeg, EveningEnd;

   //to switch to using real time, remove the "datetime Now" parameter from the procedure definition above and uncomment whichever one you want below
   //alternately, you can just call the procedure with TimeLocal() or TimeCurrent() as the parameter depending on what you want
   //datetime Now = TimeLocal();    //use local time
   //datetime Now = TimeCurrent();  //user broker time

   //we need to cast our conversions into the current date
   MorningBeg = StrToTime(TimeToStr(Now,TIME_DATE)+" "+ Start_TimeM);
   MorningEnd = StrToTime(TimeToStr(Now,TIME_DATE)+" "+ End_TimeM);
   EveningBeg = StrToTime(TimeToStr(Now,TIME_DATE)+" "+ Start_TimeE);
   EveningEnd = StrToTime(TimeToStr(Now,TIME_DATE)+" "+ End_TimeE);

   bool Morning = false;

   //Check normal case for morning , 7:00-13:00
   if (MorningBeg < MorningEnd && (Now >= MorningBeg && Now < MorningEnd))
      Morning = true;

   //Check to see if MorningBeg to MorningEnd spans 00:00, e.g. 22:00 - 04:00
   if (MorningEnd < MorningBeg && (Now >= MorningBeg || Now < MorningEnd))
      Morning = true;

   bool Evening = false;
   
   //Alert(TimeToStr(EveningBeg,TIME_DATE|TIME_MINUTES)," ",TimeToStr(EveningEnd,TIME_DATE|TIME_MINUTES)," ",TimeToStr(Now,TIME_DATE|TIME_MINUTES));
   //Check normal case for evening , 17:00 - 22:00
   if (EveningBeg < EveningEnd && (Now >= EveningBeg && Now < EveningEnd))
      Evening = true;

   //Check to see if EveningBeg-EveningEnd spans 00:00, 22:00 - 04:00
   if (EveningEnd < EveningBeg && (Now >= EveningBeg || Now < EveningEnd))
      Evening = true;
   
   return(Morning || Evening);
   
}//bool CheckTradingTimes()
Mike
garyfritz

Re: My shell EA code

Post by garyfritz »

SteveHopwood wrote:So, these mindless, turd-brained (and I use the term 'brained' with reservation), manipulative fucking bastards are forcing those of us daft enough to play their game ...
Dear me, Steve. It's not healthy to hold your feelings in. Tell us what you REALLY think. :lol:
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.

Re: My shell EA code

Post by SteveHopwood »

Latest update in post 1. Please read 'Coding the trading decision' for details.

:D
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.

Re: My shell EA code

Post by SteveHopwood »

Latest update in post 1.

Fixed a few bloops - some of them major.

Added functions to detect Stealth pending order lines. void LookForTradingOpportunities() needs some extra code to facilitate easy coding of pending/market orders, depending on the system being traded.

Lots of George influence in all this, so things are looking better and better.

:D
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.

Re: My shell EA code

Post by SteveHopwood »

Latest update in post 1.

George suggested a more efficient way of working out when to call CalculateDailyResult(0 in start(). View the comments I have left for an explanation.

George, you will be proud of me. I have removed a 'money-costing' variable from CDR. :lol:

:D
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
gaheitman
Trader
Posts: 655
Joined: Tue Nov 15, 2011 10:55 pm
Location: Richmond, VA, US

Re: My shell EA code

Post by gaheitman »

SteveHopwood wrote:Latest update in post 1.

George suggested a more efficient way of working out when to call CalculateDailyResult(0 in start(). View the comments I have left for an explanation.

George, you will be proud of me. I have removed a 'money-costing' variable from CDR. :lol:

:D
Excellent, we can all apply the savings to our trading accounts! :lol:
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.

Re: My shell EA code

Post by SteveHopwood »

gaheitman wrote:
SteveHopwood wrote:Latest update in post 1.

George suggested a more efficient way of working out when to call CalculateDailyResult(0 in start(). View the comments I have left for an explanation.

George, you will be proud of me. I have removed a 'money-costing' variable from CDR. :lol:

:D
Excellent, we can all apply the savings to our trading accounts! :lol:
Hehe. Yep.

Genuinely George, thanks for all the help in tightening up my code. You are helping lots of us enormously. As my code gets better, so does LUC have fewer opportunities to invite his buddies to lunch at our expense.

:D
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.
Post Reply

Return to “Coders Hangout”