Page 1 of 1

Need help for coding rollover/spread table

Posted: Fri Sep 18, 2009 11:04 am
by pipstar
Hi all, Hi Mr Horton :) , im trying to code a simple table on a metatrader chart for see all the swap long, swap short and spread all together for the 4 major pairs in the market watch window (or other that can add after).

The code im trying to build is :



#property copyright "Copyright ? 2005, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"

#property indicator_chart_window

int start()
{
string sComment = "";
string sp = "-------------------------------------------------------------------------\n";
string NL = "\n";
sComment = sComment + sp;
sComment = sComment + " Pairs | Swap Buy | Swap Sell | Spread |";
sComment = sComment + NL + sp;
sComment = sComment + " Pair Name 1 ";
sComment = sComment + " | " + DoubleToStr(MarketInfo(Symbol(), MODE_SWAPLONG),2);
sComment = sComment + " | " + DoubleToStr(MarketInfo(Symbol(), MODE_SWAPSHORT),2);
sComment = sComment + " | " + DoubleToStr(MarketInfo(Symbol(), MODE_SPREAD)*0.1, 1);
sComment = sComment + " |";
sComment = sComment + NL + " Pair Name 2 |";
sComment = sComment + NL + " Pair Name 3 |";
sComment = sComment + NL + " Pair Name 4 |";
Comment(sComment);
return(0);
}


Now, how can i tell with a metaeditor command to retrieve swaplong, swapshort and spread for the other pairs that isnt in the chart actually ? Sorry for my english, its my first indicator in mql language :wink:

Ive seen all the beautiful indicator with tables, values, that TRO have done, can please help done similar look ?

Below a screen of the result

thanks in advance

Posted: Sat Sep 19, 2009 2:48 pm
by flinux
Done.
It's not really nice to see.. but it works.
Remember to modify the "q" array, if you don't use mini-lots.

Replace Example:

string q[] = {"EURUSDm","GBPUSDm","USDJPYm","EURJPYm","GBPJPYm","USDCHFm","USDCADm","NZDUSDm"};

with:

string q[] = {"EURUSD","GBPUSD","USDJPY","EURJPY","GBPJPY","USDCHF","USDCAD","NZDUSD"};


Have a nice day.

Posted: Mon Sep 21, 2009 6:54 am
by pipstar
Great work Flinux, really appreciate it, thank you very much !

nice day to you :)