Successes and Failures are Parts of Trading. They are Not Permanent.

image host
AMIBROKER AFL CODE
#71
I found a very good scan code that displays buy/sell stocks for Elliot wave 1 and 2; however, the code is for a bearish impulse wave. I need to recode it to provide information for bullish impulse waves and I need some advice. Should I just reverse all the ">" and "<" operators in the code and change all the '+" and "-" or is it more complicated than that? It's interesting that it uses fractals in it's formulas. I wish I knew how to code with fractals.

Here's the code:
Code:
MedianPrice = (H+L)/2;

Jaw     = Wilders(MedianPrice,13);

//Fractal up
//----------
fUp = (Ref(H,-2) > Ref(H, -4)) AND
  (Ref(H,-2) > Ref(H, -3)) AND
  (Ref(H,-2) > Ref(H, -1)) AND
  (Ref(H,-2) > H);
var1=ValueWhen(fUp ,Ref(H,-2) ,1);
FractalUp=HighestSince(var1 > 0, var1, 1);
Plot(FractalUp, "F+",colorWhite , styleLine | styleDots);

FUpBuyPrice = FractalUp + 0.01;
FUpHit = FUpBuyPrice <= H AND FUpBuyPrice >= L;
FUpSignalOn = Flip(Ref(FractalUp,-1) != FractalUp, FUpHit);

//Fractal Down
//------------
var2=
    (Ref(L,-2) <= Ref(L, -1)) AND
    (Ref(L,-2) <= Ref(L, 0)) AND
    (Ref(L,-2) <= Ref(L, -3)) AND
    (Ref(L,-2) <= Ref(L, -4));
FractalDown=ValueWhen(var2, Ref(L,-2), 1);

FDownSellPrice= FractalDown+ 0.01;
FDownHit = FDownSellPrice <= H AND FDownSellPrice >= L;
FDownSignalOn = Flip(Ref(FractalDown,-1) != FractalDown, FDownHit );

Plot(FractalDown, "F-", colorWhite, styleLine | styleDots);

f1 = FractalDown < Jaw;
f2 = FractalUp >Jaw;
f3 = Ref(FractalDown,-1) < Jaw AND Ref ( fractalDown ,-1 )<FractalDown ;

Buy = f1 AND f2 AND f3 ;

f4 = FractalUp >Jaw;
f5 =FractalDown<Jaw;
f6 = Ref(FractalUp,-1) > Jaw  AND Ref ( fractalUp ,-1) > FractalUp;

Sell = f4 AND f5 AND f6 ;

This code is from: http://www.wisestocktrader.com/indicator...xploration
Reply
 photo TheDailyHINT01_zpsae8386eb.png
#72
(10-29-2015, 08:02 AM)Chart Hawk Wrote: I found a very good scan code that displays buy/sell stocks for Elliot wave 1 and 2; however, the code is for a bearish impulse wave. I need to recode it to provide information for bullish impulse waves and I need some advice. Should I just reverse all the ">" and "<" operators in the code and change all the '+" and "-" or is it more complicated than that? It's interesting that it uses fractals in it's formulas. I wish I knew how to code with fractals.

Here's the code:
Code:
MedianPrice = (H+L)/2;

Jaw     = Wilders(MedianPrice,13);

//Fractal up
//----------
fUp = (Ref(H,-2) > Ref(H, -4)) AND
  (Ref(H,-2) > Ref(H, -3)) AND
  (Ref(H,-2) > Ref(H, -1)) AND
  (Ref(H,-2) > H);
var1=ValueWhen(fUp ,Ref(H,-2) ,1);
FractalUp=HighestSince(var1 > 0, var1, 1);
Plot(FractalUp, "F+",colorWhite , styleLine | styleDots);

FUpBuyPrice = FractalUp + 0.01;
FUpHit = FUpBuyPrice <= H AND FUpBuyPrice >= L;
FUpSignalOn = Flip(Ref(FractalUp,-1) != FractalUp, FUpHit);

//Fractal Down
//------------
var2=
    (Ref(L,-2) <= Ref(L, -1)) AND
    (Ref(L,-2) <= Ref(L, 0)) AND
    (Ref(L,-2) <= Ref(L, -3)) AND
    (Ref(L,-2) <= Ref(L, -4));
FractalDown=ValueWhen(var2, Ref(L,-2), 1);

FDownSellPrice= FractalDown+ 0.01;
FDownHit = FDownSellPrice <= H AND FDownSellPrice >= L;
FDownSignalOn = Flip(Ref(FractalDown,-1) != FractalDown, FDownHit );

Plot(FractalDown, "F-", colorWhite, styleLine | styleDots);

f1 = FractalDown < Jaw;
f2 = FractalUp >Jaw;
f3 = Ref(FractalDown,-1) < Jaw AND Ref ( fractalDown ,-1 )<FractalDown ;

Buy = f1 AND f2 AND f3 ;

f4 = FractalUp >Jaw;
f5 =FractalDown<Jaw;
f6 = Ref(FractalUp,-1) > Jaw  AND Ref ( fractalUp ,-1) > FractalUp;

Sell = f4 AND f5 AND f6 ;

This code is from: http://www.wisestocktrader.com/indicator...xploration

This looks like a code for Bill Williams Alligator system. Just change the Buy and Sell conditions of your choice. I don't use EW but I do have fractals on my charts.



"A man should look for what is, and not for what he thinks should be." - Albert Einstein
Reply
#73
Amibroker has a javascript code called Cleanup.js to cleanup the database of stocks that have been delisted and are no longer traded at the exchanges. I've tried using the code and it has a yes/no option for whether or not to delete a stock in question. I get so many of the stocks that need to be deleted, I need to change the code to just delete them automatically without asking me. Does anyone here know javascript who can help me do this? The code is very short.
Code:
/* detection threshold (in days)  */
var Threshold = 30; // one month for example
/* by default do not delete */
var DeleteByDefault = false;
/* ask the user for the decision */
var AskUser = true;
/* a timeout to wait until default route (no deletion) is taken */
var Timeout = 5;

var oAB = new ActiveXObject("Broker.Application");
var fso = new ActiveXObject("Scripting.FileSystemObject");
var Shell = new ActiveXObject("WScript.Shell");


var oStocks = oAB.Stocks;

var MiliSecInDay = 24 * 60 * 60 * 1000;

var Continue = true;

var StockQty = oStocks.Count;

var oStocksToDelete = new Array;
var oStocksNotTraded = new Array;

if( ! AskUser ) WScript.Echo("Cleanup script started" );

for( i = 0; i < StockQty && Continue; i++ )
{
    oStock = oStocks( i );

    var Qty = oStock.Quotations.Count;

    var response = 0;

    if( Qty > 0 )
    {
        oQuote = oStock.Quotations( Qty - 1 );

        var oDate = new Date( oQuote.Date );

        var Today = new Date();

        DaysNotTraded = Math.floor( ( Today - oDate )/MiliSecInDay );

        if( DaysNotTraded > Threshold )
        {
            if( AskUser ) response = Shell.popup( oStock.Ticker + " is not traded since " + oDate.toLocaleString() + " (" + DaysNotTraded + " days).\nDo you wish to delete it?\n(Press Cancel to end the process)", Timeout, "Confirm delete", 3 + 256 );
            else          response = 6; /* default */
        }
    }
    else
    {
        if( AskUser ) response = Shell.popup( oStock.Ticker + " has no quotes. Do you wish to delete it?",  Timeout, "Confirm delete", 3 + 256 );
        else          response = 6; /* default */
    }

    /* change default route if needed */
    if( response == -1 && DeleteByDefault ) response = 6;

    switch( response )
    {
        case -1:/* Timeout - fallback to no */
        case 7: /* No */
                oStocksNotTraded[ oStocksNotTraded.length ] = oStock.Ticker;
                break;
        case 6: /* Yes */
                oStocksToDelete[ oStocksToDelete.length ] = oStock.Ticker;
                break;
        case 2: /* Cancel */
                Continue = false;
                break;
        default: break;
    }
}

if( oStocksToDelete.length > 0 && Shell.popup( "You are now about to delete " + oStocksToDelete.length + " stock(s).\nDo you wish to proceed?" , 0, "Confirm delete", 4 + 256 ) == 6 )
{
    for( i = 0; i < oStocksToDelete.length; i++ )
    {
        oStocks.Remove( oStocksToDelete[ i ]  );
    }

    oAB.RefreshAll();
}

if( oStocksNotTraded.length > 0 && Shell.popup( "There are " + oStocksNotTraded.length + " not traded stock(s) detected but not deleted by your choice.\nDo you wish to save their tickers to \"nottraded.txt\" file?" , 0, "Confirm save", 4 + 256 ) == 6 )
{
    f = fso.OpenTextFile( "nottraded.txt", 2, true );    

    for( i = 0; i < oStocksNotTraded.length; i++ )
    {
        f.WriteLine( oStocksNotTraded[ i ]  );
    }

    f.Close();
}

WScript.Echo("Cleanup script finished" );
Reply
#74
puede po magpatulong. kelangan ko po ng buy sell trading arrows para sa stocks (close greater than 1% from yesterday) with higher volume than yesterday and sell trading arrows para sa stocks (close less than -1% from yesterday) with higher volume than yesterday. eto po AFL ko sa baba pero ayaw lumabas ng sell arrows.thank you.


Buy = Close >= 1.1 * Ref( Close,-1) AND Volume > Ref(Volume,-1);
Sell = Close <= -1.1 * Ref(Close,-1) AND Volume > Ref(Volume,-1);
Reply
#75
(04-14-2016, 01:40 PM)sventhedog Wrote: puede po magpatulong. kelangan ko po ng buy sell trading arrows para sa stocks (close greater than 1% from yesterday) with higher volume than yesterday and sell trading arrows para sa stocks (close less than -1% from yesterday) with higher volume than yesterday. eto po AFL ko sa baba pero ayaw lumabas ng sell arrows.thank you.


Buy = Close >= 1.1 * Ref( Close,-1) AND Volume > Ref(Volume,-1);
Sell = Close <= -1.1 * Ref(Close,-1) AND Volume > Ref(Volume,-1);

Try this:

Buy = close >= 1.01*ref(close,-1) and Volume > ref(volume,-1);
Sell = close <= 0.99*ref(close,-1) and volume > ref(volume,-1);

PlotShapes(IIf(sell==1,shapeDownArrow, shapeNone), colorRed, 0,High, Offset=-15);

PlotShapes(IIf(buy==1,shapeUpArrow , shapeNone), ColorRGB(168,255,0), 0, Low, Offset=-15)
Reply
#76
thank you sir indo. working sya.

bakit hindi nagwork pag pinalitan ko values? gagawin ko po sana >1.5% and <-0.2% instead of >1% and -1%. pag ibang values, mga stocks lang lumalabas, hindi kasama yung ^psei, ^allshares, etc.

Buy = close >= 1.51*ref(close,-1) and Volume > ref(volume,-1);
Sell = close <= 0.19*ref(close,-1) and volume > ref(volume,-1);

PlotShapes(IIf(sell==1,shapeDownArrow, shapeNone), colorRed, 0,High, Offset=-15);

PlotShapes(IIf(buy==1,shapeUpArrow , shapeNone), ColorRGB(168,255,0), 0, Low, Offset=-15);
Reply
#77
QuoteRoom For Amibroker

Does anyone know if QuoteRoom works with Amibroker?

Quote:http://www.forexite.com
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)
image host