Help with static price, and alerts

#1
Hi Guys.....I am a new member, but a long time user of amibroker. I code basic strategies for my own..nothing fancy, so please bear with me if my queries sound to primitive.
I have the following code for my order entry. Im having the following issues.
1. When the price hits my Buy Condition, a price label is created on the chart which shows the price at that time. But then the price keeps on changing so long as the condition is true, even if its going higher and higher. The price on the label keeps on changing. How can i set it to show the price that was true at the first trigger? How do i assign it a static value?
2. I run this strategy on multiple timeframes..so i have 2 or 3 timeframes open at a time. But the alert output only shows alerts from the highlighted chart. Is there a way to make sure i get alerts from all charts that are running the strategy? Can i also run it on different symbols and get the alerts generated for each symbol?
Thank you for your help.
Code:
//======ORDER BUY AND SELL ORDERS BASED ON CONDITIONS DEFINED===========
Buy = BuyCDN; //
Sell = Low <= Ref(HaLow,-NumofBars);
Buy = ExRem(Buy, Sell);
Sell = ExRem(Sell, Buy);

ActualBuy = ValueWhen(Buy, C);
ActualBStop = ValueWhen(Sell, C);

//===========CREATE PRICE LABELS ON CHART======================
dist = 2;
for( i = 0; i < BarCount; i++ )
{
if( Buy ) PlotText( "[email protected]" + ActualBuy [i ], i, L[ i ]-dist, colorWhite,colorGreen );
if( Sell ) PlotText( "[email protected]" + ActualBStop[ i ], i, H[ i ]+dist, colorRed, colorYellow );
}

//===========CREATE ALERTS TO SHOW IN ALERT OUTPUT===========================
TF = Interval(2);
AlertIf( Buy, "", TF+ " Buy at " +ActualBuy, 1, 1+2+4+8, lookback = 1);  
AlertIf( Sell, "",TF+" Buy Stop at " +ActualBStop, 2, 1+2+4+8, lookback = 1 );
 
#2
It depends on your buy and sell condition. If buy is break of a level.. then call it in as
ActualBuy = ValueWhen(Buy, break level);
 

Similar threads

Zerodha – Open Paperless Account

Open online account with Zerodha. Free delivery trading and Max Rs 20 for Intraday, F&O, Currency and Commodity Trading. Intraday High leverage with MIS, CO and BO.

Name:Phone:
Email:City:
State:
Are you a day trader?