Simple Coding Help - No Promise.

checkmate7

Well-Known Member
hi @bbhanushali

Found this code for pop-up in exploration :

// one time popup example by trash ....
// http://www.traderji.com/newreply.php?do=postreply&t=78419
/////////////////////////////////////////////////////////////////////////

period = 5; // number of averaging periods
m = MA( Close, period );
Buy = Cross( Close, m );
Sell = Cross( m, Close );

if( Status( "action" ) == actionIndicator )
{
Buy = ExRem( Buy, Sell );
Sell = ExRem( Sell, Buy );

alertstr = Name() + "_Last Bartime:" + DateTimeToStr( LastValue( DateTime() ) );

buyid = "ID:1";
sellid = "ID:2";

duration = secleft(); // one popup ocurrence AFTER confirmed signal

if ( LastValue( Ref( Buy, -1 ) ) )
PopupWindowEx( buyid, "Buy " + alertstr, "Buy Alert", duration, -1, -1 );

if ( LastValue( Ref( Sell, -1 ) ) )
PopupWindowEx( sellid, "Sell " + alertstr, "Sell Alert", duration, 0, 0 );

Title = "Intrabar " + StaticVarGetText( "prevPopup:" + buyid ) +
"\nIntrabar " + StaticVarGetText( "prevPopup:" + sellid ) +
"\nBartime left: "+ duration;

Plot( Buy, "True Buy Sig", colorGreen, styleHistogram, 0, 1, 0, 0, width = -80 );
Plot( Sell, "True Sell Sig", colorRed, styleHistogram, 0, 1, 0, 0, width );
}

But getting 3 errors, pic attached :).

Could you kindly look into it.

Cheers
JS
 

Attachments

hi @bbhanushali

Found this code for pop-up in exploration :

// one time popup example by trash ....
// http://www.traderji.com/newreply.php?do=postreply&t=78419
/////////////////////////////////////////////////////////////////////////

period = 5; // number of averaging periods
m = MA( Close, period );
Buy = Cross( Close, m );
Sell = Cross( m, Close );

if( Status( "action" ) == actionIndicator )
{
Buy = ExRem( Buy, Sell );
Sell = ExRem( Sell, Buy );

alertstr = Name() + "_Last Bartime:" + DateTimeToStr( LastValue( DateTime() ) );

buyid = "ID:1";
sellid = "ID:2";

duration = secleft(); // one popup ocurrence AFTER confirmed signal

if ( LastValue( Ref( Buy, -1 ) ) )
PopupWindowEx( buyid, "Buy " + alertstr, "Buy Alert", duration, -1, -1 );

if ( LastValue( Ref( Sell, -1 ) ) )
PopupWindowEx( sellid, "Sell " + alertstr, "Sell Alert", duration, 0, 0 );

Title = "Intrabar " + StaticVarGetText( "prevPopup:" + buyid ) +
"\nIntrabar " + StaticVarGetText( "prevPopup:" + sellid ) +
"\nBartime left: "+ duration;

Plot( Buy, "True Buy Sig", colorGreen, styleHistogram, 0, 1, 0, 0, width = -80 );
Plot( Sell, "True Sell Sig", colorRed, styleHistogram, 0, 1, 0, 0, width );
}

But getting 3 errors, pic attached :).

Could you kindly look into it.

Cheers
JS
@JediStar : There are two function's missing "GetSecondNum()" and "PopupWindowEx( popupID, bodytext, captiontext, timeout, left, top )" in the code given by you.
1. Just find and add them before the start of code and it will work. (if already there then);
2. e.g. {PopupWindowEx( buyid, "Buy " + alertstr, "Buy Alert", duration, -1, -1 );} and
{PopupWindowEx( sellid, "Sell " + alertstr, "Sell Alert", duration, 0, 0 );} with curly brackets after "if...." command.
3. I am not able to decipher in the partial code. This is the most likely one!
Thanks.
 
Hi there,

I am looking out for a code with SL and TGTs to reflect on intraday chart.

Please find below condition:

Entry Price = 5Day EMA.

Stop loss = 35 points. It should remain for T+2 days (e.g if Entry Price is 10000 then long SL is 10000-35=9965 and short SL is 10000+35=10035).

Targets = should be from entry price
TGT 1 -1%
TGT2 - 1.5%
TGT3 - 2%
TGT4 - 2.5%
TGT5 - 3%
e.g.
For long
TGT1 - 10000+100 =10100
TGT2 - 10000+150=10150
TGT3 - 10000+200=10200
TGT4 - 10000+250=10250
TGT5 - 10000+300 = 10300

For Short
TGT1 - 10000-100 =9900
TGT2 - 10000-150=9850
TGT3 - 10000-200=9800
TGT4 - 10000-250=9750
TGT5 - 10000-300 = 9700

Kindly let me know in case need any more information.
 
@JediStar : There are two function's missing "GetSecondNum()" and "PopupWindowEx( popupID, bodytext, captiontext, timeout, left, top )" in the code given by you.
1. Just find and add them before the start of code and it will work. (if already there then);
2. e.g. {PopupWindowEx( buyid, "Buy " + alertstr, "Buy Alert", duration, -1, -1 );} and
{PopupWindowEx( sellid, "Sell " + alertstr, "Sell Alert", duration, 0, 0 );} with curly brackets after "if...." command.
3. I am not able to decipher in the partial code. This is the most likely one!
Thanks.
Thank you very much @bbhanushali. Will check and revert on this one. Appreciate your findings.
Cheers
JS
 

Similar threads