I am writing a chart trader and would like to display text on the
screen that does not change when the mouse is moved. Because of the
AFL runs on the conecpt of arrays, my panel changes value when the
cursor is moved.
the following afl runs in its own pane. I get the text written to the
panel. however, it disappears as soon as i click the panel. how do i
avoid it.
INDICAT=1;
BUY_CODE="BY";
SHORT_CODE="SH";
STOP_CODE="ST";
TARGET_CODE="RE";
TRADE_SHORT="SHORT";
TRADE_LONG="BUY";
POSITION_VALUE=3000;
alertText="Messages: \n";
errorText="All Errors \n";
errorCode=0;
MISSING_TRADE_DATA=-10;
/*
Risk_Reward_Ratio=0;
PotentialProfit=0;
PotentialLoss=0;
NoOfSharesToBuy=0;
*/
CellHeight = 50;
CellWidth = 300;
//GfxSelectFont( "Tahoma", CellHeight/2 );
trigger = ParamTrigger("Place Order", "Click here to place order");
TradeDirection=ParamList("Trade Direction" ,TRADE_SHORT + "," +
TRADE_LONG);
POSITION_VALUE=Param("Value Of Position" ,3000,0,100000);
CHARTID_OF_SIGNALS=Param("ChartId Signal Panel",1);
if( trigger AND (Status( "action" )==INDICAT) ) {
switch(TradeDirection){
case TRADE_SHORT:
PopupWindow("Got a trigger
short","Trigger short");
case TRADE_LONG:
PopupWindow("Got a trigger
LONG" ,"Trigger LONG");
// CHECK IF ALL THE VALUES
ARE THERE TO DO THE LONG TRADE
BuyPrice=LastValue(Study
(BUY_CODE, CHARTID_OF_SIGNALS ));
StopPrice=LastValue(Study
(STOP_CODE, CHARTID_OF_SIGNALS) );
TargetPrice=LastValue(Study
(TARGET_CODE, CHARTID_OF_SIGNALS ));
alertText=" Buy price " +
NumToStr(BuyPrice) + "\n" +
"
Stop price " + NumToStr(StopPrice) + "\n" +
"
Target Price " + NumToStr(TargetPrice) + "\n" ;
if(BuyPrice==0){
errorText= errorText
+ "Buy Price is missing \n";errorCode=MISSING_TRADE_DATA;
}
if(StopPrice==0){
errorText= errorText
+ "Stop Price is missing \n";errorCode=MISSING_TRADE_DATA;
}
if(TargetPrice==0){
errorText= errorText
+ "Target Price is missing \n";errorCode=MISSING_TRADE_DATA;
}
if(errorCode ==0){
// Build Potential Trade
Stats and request confirmation.
// round it to the Tens's
NoOfSharesToBuy=(round
((POSITION_VALUE/BuyPrice) /10))*10;
profitPotential=TargetPrice-
BuyPrice;
LossPotential=BuyPrice-
StopPrice;
Risk_Reward_Ratio=NumToStr
(profitPotential/LossPotential) + ":" + "1" ;
alertText= alertText + "No of
Shares to Buy" + NumToStr(NoOfSharesToBuy) + "\n";
alertText= alertText
+ "profit Potential" + NumToStr(profitPotential) + "\n";
alertText= alertText + "Loss
Potential" + NumToStr(LossPotential) + "\n";
alertText= alertText + "Risk
Reward Ratio" + Risk_Reward_Ratio + "\n";
}
}
// WRITE VALIDATION TO ENSURE THAT THE STUDY LINES
ARE FLAT sometime in future.
}
// display the text to the user
//PopupWindow(alertText + errorText +errorCode ,TRADE_LONG + " "
+ Name(),15);
GfxDrawText( alertText + errorText + WriteVal
(errorCode),10,10,300,300);