Free Margin Message

 

Hello Coders/Traders:

I am attempting to write a piece of code that will constantly display my free margin in the upper left hand corner of my chart. I've tried using the following:

ObjectSetText("text_object", "Acct Free Margin", 10, "Times New Roman", Green);

And also:

ObjectSetText("text_object", "Hello world!", 10, "Times New Roman", Green);
ObjectSet("text_object", OBJPROP_XDISTANCE, 100);

I haven't had much luck though. Should the code go in the Initialization or start functions?

Thanks

Chicago Pat

 

FPC

Just put this function in an EA

start()

{

  Display_Info()

// ================= other code===========================



// ================= other code===========================


return (0);
}


void Display_Info()
{
   Comment("SelectFX Expert Adviser\n",
            "Desc: ",strComment,"\n",
            "Magic Number: ", iMagic,"\n",
            "Forex Account Server:",AccountServer(),"\n",
            "Free Margin:  $",AccountFreeMargin(),"\n",
            "Lots:  ",Lots,"\n",
            "Symbol: ", Symbol(),"\n",
            "Price:  ",NormalizeDouble(Bid,4),"\n",
            "Pip Spread:  ",MarketInfo(strSymbol,MODE_SPREAD),"\n",
            "Date: ",Month(),"-",Day(),"-",Year()," Server Time: ",Hour(),":",Minute(),":",Seconds(),"\n",
            "Minimum Lot Size: ",MarketInfo(Symbol(),MODE_MINLOT));
   return(0);
}

and call it in start()

Good Luck

-BB-

 
BarrowBoy wrote >>

FPC

Just put this function in an EA

and call it in start()

Good Luck

-BB-

BarrowBoy
wrote
>>

FPC

Just put this function in an EA

and call it in start()

Good Luck

-BB-

BarrowBoy, you're the man! I got it up and running, thanks.