wp_redirect not working on plugin

You can also consider a Javascript solution by adding a portion of code that will redirect people to the page if not loggued in :

<?php
/*
Plugin Name: Héroes y Pasta
*/
    include_once(ABSPATH . 'wp-admin/includes/plugin.php');
    function iniciatodo() {
        if(is_user_logged_in()) {
?>
            <p>Hola tio</p>
<?php
        } else { ?>
            <script>window.location.href="http://gexy.es.cx/login/";</script>
       <?php }
    }
    add_shortcode("inicia_todo", "iniciatodo");