//+------------------------------------------------------------------+
//| RSSXample.mq4 |
//| sexytrade |
//| sexytrade.isgreat.org |
//+------------------------------------------------------------------+
#property copyright "sexytrade"
#property link "sexytrade.isgreat.org"
//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+
int start()
{
//----
int handlerss=FileOpen("test.rss", FILE_READ, ';');
if(handlerss<0)
{
handlerss=FileOpen("test.rss", FILE_WRITE, ';');
handlerss=FileOpen("test.rss", FILE_READ, ';');
}
string BuyStrrss="GBPJPY 1.0 lots @ "
+DoubleToStr(MarketInfo("GBPJPY",MODE_BID),MarketInfo("GBPJPY",MODE_DIGITS))
+" || "
,SellStrrss="EURJPY 1.5 lots @ "
+DoubleToStr(MarketInfo("EURJPY",MODE_BID),MarketInfo("EURJPY",MODE_DIGITS))
+" || "
;
if(handlerss>0)
{
if(FileSize(handlerss)==0)
{handlerss=FileOpen("test.rss", FILE_WRITE, ';');
FileWrite(handlerss
,"SexyTrade"
+"http://sexyhedge.blogspot.com/"
+"http://myhdiary.isgreat.org/images/feed.png"
+"Daily GBPJPY ~ EURJPY Hedge."
+""
+"Today Signal : "+TimeToStr(TimeCurrent(),TIME_DATE)+""
+"http://sexyhedge.blogspot.com/"
+""
+"BUY : "
+BuyStrrss
+"SELL : "
+SellStrrss
+"Close Whenever You Satisfy."
+""
+""
);
FileClose(handlerss);
}
else
{
string rss=FileReadString(handlerss);
int len=StringLen(rss);
string rss1=""
+"$_$ Today Signal : "+TimeToStr(TimeCurrent(),TIME_DATE)+""
+"http://sexyhedge.blogspot.com/"
+""
+"BUY : "
+BuyStrrss
+"SELL : "
+SellStrrss
+"Close Whenever You Satisfy."
+""
+""
// +""
,rsst=StringSubstr(rss,0,230)
,rssb=StringSubstr(rss,230,0)
;
handlerss=FileOpen("test.rss", FILE_WRITE, ';') ;
FileWrite(handlerss,rsst+rss1+rssb);
FileClose(handlerss);
}
}
SendFTP("test.rss",NULL);
//----
return(0);
}
//+------------------------------------------------------------------+k>"+YourDomain+""
+"" // Signal begin
+"BUY : "
+BuyStrrss
+"SELL : "
+SellStrrss
+FinishingText // Some words here.
+""
+""
);
FileClose(handlerss); // Finished first time signal
}
else//.................................................... In case not the frist time signal
{
string rss=FileReadString(handlerss); // get the whole strings from test.rss
string rssHeader= "" // this is the XML header
+""
+""
+""+YourRSSTitle+""
+""+YourDomain+""
+""+YourIMG_Path+""
+""+YourBrifeDesc+""
;
int len=StringLen(rssHeader); // how many characters it contains?
string rss1="" // your latest signal
+""+YourSigTitle+TimeToStr(TimeCurrent(),TIME_DATE)+""
+""+YourDomain+""
+""
+"BUY : "
+BuyStrrss
+"SELL : "
+SellStrrss
+FinishingText
+""
+""
,rsst=StringSubstr(rss,0,len) // get the XML header, it contains "len" characters
,rssb=StringSubstr(rss,len,0) // get the rest (old) XML code, all after the header
;
handlerss=FileOpen("test.rss", FILE_WRITE, ';') ; // Now open the file to insert new signal
FileWrite(handlerss,rsst+rss1+rssb); // Combine XML header, new signal and the rest
FileClose(handlerss); // Finished. New signal added
}
}
SendFTP("test.rss",NULL); // Send your RSS to the webhost server.
//----
return(0);
}
//+------------------------------------------------------------------+